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

[Feature]: support native ESM modules from CDN #23508

Open
1 task done
Hotell opened this issue Jun 13, 2022 · 10 comments
Open
1 task done

[Feature]: support native ESM modules from CDN #23508

Hotell opened this issue Jun 13, 2022 · 10 comments

Comments

@Hotell
Copy link
Contributor

Hotell commented Jun 13, 2022

Library

React Components / v9 (@fluentui/react-components)

Describe the feature that you would like added

ATM v9 ships only as CommonJS and ESM module format.

Trying to use ESM from CDN fails as unpkg.com uses wrong content-type for ES modules thus user gets following error:

🚨 Failed to load module script: Expected a JavaScript module script but the server responded with a MIME type of "text/html". Strict MIME type checking is enforced for module scripts per HTML spec..

Instead content-type: text/html; it should use content-type: text/javascript;.

Repro: https://stackblitz.com/edit/web-platform-jskm9z?file=index.html

Trying to mitigate this via skypack CDN fixes this partially but fails short on react-icons package:

image

Have you discussed this feature with our team

No response

Additional context

No response

Validations

  • Check that there isn't already an issue that request the same feature to avoid creating a duplicate.
@JustSlone
Copy link
Collaborator

+1 on this, we should fix this when we have time. Lower priority, but if it's an easy fix sooner rather than later would be better.

@msft-fluent-ui-bot
Copy link
Collaborator

Because this issue has not had activity for over 150 days, we're automatically closing it for house-keeping purposes.

Still require assistance? Please, create a new issue with up-to date details.

@msft-fluent-ui-bot msft-fluent-ui-bot added the Resolution: Soft Close Soft closing inactive issues over a certain period label Mar 23, 2023
@Hotell Hotell reopened this Mar 24, 2023
@microsoft-github-policy-service

Because this issue has not had activity for over 150 days, we're automatically closing it for house-keeping purposes.

Still require assistance? Please, create a new issue with up-to date details.

1 similar comment
@microsoft-github-policy-service

Because this issue has not had activity for over 150 days, we're automatically closing it for house-keeping purposes.

Still require assistance? Please, create a new issue with up-to date details.

@microsoft-github-policy-service

Because this issue has not had activity for over 150 days, we're automatically closing it for house-keeping purposes.

Still require assistance? Please, create a new issue with up-to date details.

@Hotell
Copy link
Contributor Author

Hotell commented Mar 26, 2024

we will land native ESM browser support for tokens package first via adding .js extensions. after that's validated we can apply that approach to the rest of v9 controls.

NOTE: using native ESM for production applications without bundling in React ecosystem is something that is not encouraged to do, so the impact of this change is merely for following platform standards not as a shift of approach for applications.

@jason-ha
Copy link

jason-ha commented Jun 4, 2024

NOTE: using native ESM for production applications without bundling in React ecosystem is something that is not encouraged to do, so the impact of this change is merely for following platform standards not as a shift of approach for applications.

While using React without a bundler might be encouraged, it is another thing to make it required all the time. When I came across this it was for an app that does use a bundler before running, but it also uses jest to test which doesn't need bundling. Currently the app is configured to build and test CommonJS because of this issue. It has no need to build CommonJS otherwise.
If ESM is not fully supported, then why not leave support out of packages?

@jason-ha
Copy link

Since not fixing this support yet and deemed lower priority, could the failing ESM support be removed?
Make it so that Bug #30778 isn't hit by consumers.

@Hotell
Copy link
Contributor Author

Hotell commented Sep 26, 2024

could the failing ESM support be removed?

I don't follow . can you please be more explicit and provide actual reproduction (where I can run a test and see the failure) ? ty

@jason-ha
Copy link

@Hotell, an example is in the https://codesandbox.io/p/sandbox/pedantic-mopsa-423pkr found in the Bug.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants