You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This would probably also require to change the js extension into mjs or to write another package.json file in the es folder containing at least (as stated here):
In Node 13, ES modules are enabled by default (they don't require an experimental flag as for previous versions). Because more and more browser also conform to ES modules, developers will probably soon want to use them everywhere. As ES modules are already published by material-ui, I feel this would not be a big work to make them easily accessible.
We can, of course, directly import the es sub-folder, but:
it is considered bad practice by linters,
when using TypeScript, types cannot be associated to files in the es folder.
Your example is already supported. Did this stop working in node 13?
We can, of course, directly import the es sub-folder
We don't recommend this. Use aliases in your build process instead.
Closing this in favor of #18447. The esmodule story of node will be part of this story. But we have to draw up a concrete plan. I'm especially concerned that the new esm API did not account for different bundle targets beyond the used module (modern, es6, ie11 etc.)
Your example is already supported. Did this stop working in node 13?
It is not working when writing ES module in node (either using node 13, or node 12 with --experimental-modules, not sure for previous versions, and setting "type": "module" in the package.json).
This is because it is impossible to destructure an imported CommonJS module from an ES module. You have to do:
I would like to be able to use the ES version of material-ui in a project using a modern node version (> 13.7).
Summary 💡
As stated in the NodeJS 13 doc, the ES module entry point for NodeJS should not be specified in a
module
entry, but in anexports
structure.A NodeJS project could automatically use the ES version if this version was indicated in the package.json file:
This would probably also require to change the
js
extension intomjs
or to write anotherpackage.json
file in thees
folder containing at least (as stated here):Examples 🌈
This would allow to do something like:
whether in a ES module or a CommonJS project.
Motivation 🔦
In Node 13, ES modules are enabled by default (they don't require an
experimental
flag as for previous versions). Because more and more browser also conform to ES modules, developers will probably soon want to use them everywhere. As ES modules are already published by material-ui, I feel this would not be a big work to make them easily accessible.We can, of course, directly import the
es
sub-folder, but:es
folder.Note: this issue may be related to #18447.
The text was updated successfully, but these errors were encountered: