Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: improve transform configs on sdk #2643

Merged
merged 14 commits into from
Jun 29, 2024
Merged

Conversation

ScriptedAlchemy
Copy link
Member

Description

If CORS headers are not set the application will fail to load remotes with crossorigin=anonymous
As fallback, attempt to inject script without cors tags

Related Issue

Types of changes

  • Docs change / refactoring / dependency upgrade
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)

Checklist

  • I have added tests to cover my changes.
  • All new and existing tests passed.
  • I have updated the documentation.

Copy link

changeset-bot bot commented Jun 22, 2024

⚠️ No Changeset found

Latest commit: 8ea2a1d

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link

netlify bot commented Jun 22, 2024

Deploy Preview for module-federation-docs ready!

Name Link
🔨 Latest commit 8ea2a1d
🔍 Latest deploy log https://app.netlify.com/sites/module-federation-docs/deploys/667f859df3927f0008d5452e
😎 Deploy Preview https://deploy-preview-2643--module-federation-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@ScriptedAlchemy ScriptedAlchemy force-pushed the fix/cors-error-fallback branch 3 times, most recently from 143338b to af40bd6 Compare June 22, 2024 00:52
@ScriptedAlchemy ScriptedAlchemy force-pushed the fix/cors-error-fallback branch from af40bd6 to 35f347d Compare June 22, 2024 01:18
packages/sdk/jest.config.js Outdated Show resolved Hide resolved
packages/sdk/src/dom.ts Outdated Show resolved Hide resolved
@ScriptedAlchemy
Copy link
Member Author

@zhoushaw should we rather pass a flag from user options to enable crossorigin attribute or if user implements manifest then we enable cross origin?
In current state, this breaks default setup and in some cases like next.js requires additional work to try and debug.
The standard js format of a remote should be able to transmit as freely as possible. If the user wants to implement additional features like json remote. They will need cors configured to do so. But the default experience would still work out the box.

packages/sdk/src/dom.ts Outdated Show resolved Hide resolved
# Conflicts:
#	apps/3000-home/next.config.js
#	apps/3000-home/pages/_app.tsx
#	apps/3001-shop/next.config.js
#	apps/3001-shop/pages/_app.tsx
#	apps/3002-checkout/next.config.js
#	apps/3002-checkout/pages/_app.tsx
@ScriptedAlchemy ScriptedAlchemy force-pushed the fix/cors-error-fallback branch 2 times, most recently from bc96f53 to 34abe46 Compare June 29, 2024 03:45
@ScriptedAlchemy ScriptedAlchemy force-pushed the fix/cors-error-fallback branch from 34abe46 to 31a12b8 Compare June 29, 2024 03:47
@ScriptedAlchemy ScriptedAlchemy changed the title fix(sdk): re inject script in fallback case for cors chore: fix transform configs on sdk Jun 29, 2024
@ScriptedAlchemy ScriptedAlchemy changed the title chore: fix transform configs on sdk chore: improve transform configs on sdk Jun 29, 2024
@ScriptedAlchemy ScriptedAlchemy merged commit efe716f into main Jun 29, 2024
9 checks passed
@ScriptedAlchemy ScriptedAlchemy deleted the fix/cors-error-fallback branch June 29, 2024 04:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants