-
Notifications
You must be signed in to change notification settings - Fork 3k
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
ESM version is never used #6321
Comments
I'm looking through the solutions here and none of them seem ideal: https://webpack.js.org/guides/package-exports/#target-environment-independent-packages One thing I know comes up is situations where people are doing In other news: God, I hate module systems. |
Core Team Meeting: We probably can't act on this during version 7, because it would incur a breaking change for some folks. But we definitely want to move to modern ESM in version 8, probably ES2018+. |
Could you add an simple Another import thing to note: ESM modules under |
None of published module in rx is native esm so we can't / won't specify separate pkg manifest to esm. Supporting native esm is another topic core team discusses heavily to ensure avoiding potential regressions with ecosystem support, but this specific topic is not intend to make changes to current esm into native one. |
Great to hear, looking forwad to RxJS 8! 🥳 |
Any updates on this? I tried using he 8.0.0-alpha.3 build but I'm still getting this failure when using ESM and trying to import: import {TestScheduler} from 'rxjs/testing'
|
Also looking very much forward to this |
2 months has passed again, does anyone have any updates, suggestions, workarounds or help? |
It seems like, even if you would resolve to the ESM artifacts, the |
v8 is going to consolidate on ES2022 and get rid of ES5. That should resolve this issue. |
@benlesh, can you provide a link to the ES2022 issue? I only found mention of ES2021:
|
Bug Report
Current Behavior
ES5
version is always used in client project when we build it withrollup
orwebpack
even if we setmainFields
toes2015
to takepackage.json
attribute like in previous version.CJS
version is always used in node project even if we want to use module in latest node runtime.This is due to the
exports
attribute inpackage.json
which only declaresnode
anddefault
values.Expected behavior
ESM
version should be used when client project is built and we are usingrxjs
withimport
injavascript
ortypescript
code and we want to build a script compatible withHTML <script type="module"> in HTML
ESM
version should be used in node project if inpackage.json
we settype:module
attribute and we used it in latest runtime.Reproduction
In a client project,
After that, you have to build the client project and you will see that only
ES5
version is taken and notESM
version even if we setmainFields
toes2015
inwebpack
orrollup
config.In a Node project,
Build your project and in
package.json
settype:module
and you will see that onlyCJS
version is taken.Environment
7.0.0
Possible Solution
You can see all possibilities here and we have to make a proposition to change
package.json:exports
attributeYou can see examples in the link provided before and they are explaining how to manage
node
andmodule
version.If we don't change the
exports
attribute, we should allow build system to take the good version we want usingmain
,module
ores2015
attributes frompackage.json
like it was possible in previous version especially for client project.The text was updated successfully, but these errors were encountered: