-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Awkward ES6 imports #2582
Comments
We are aware of the "issue". The way how node has implemented support for modules creates a ripple effect on the whole ecosystem - what worked for years in other tools suddenly doesn't work in node. We'll think about solutions for this, but the problem is that it's very hard to pull off a solution that would just work for every possible combination of environments and tools. And on top of that making changes around this might require a major bump. |
Sure. I would try to help, but I don't know the details of how node handles it. The way that @mui handles it is with an index.js file which acts as a giant barrel file, exporting everything for ES6. CJS is handled via "main" which points to a cjs file in a subdirectory. I don't know if that's helpful to you. |
Any update? |
any update on this? |
Current behavior:
Importing createCache from @emotion/cache in an ES6 environment (type: module in package.json) does not import the function, but an object with a default property is the function
Output:
package.json
To reproduce:
Repro repo: https://github.com/RobertSandiford/emotion-cache-es6-imports
Expected behavior:
The create cache function is exported to createCache
Other notes:
When packed with webpack the above code will work.
Getting the create cache function in ES6 requires accessing the default property.
This requires code like this to work server side + client side.
It's likely that this issues exists in other places too. I had issues with @emotion/server/create-instance too. Currently I have this code
Environment information:
@emotion/cache
version: 11.6The text was updated successfully, but these errors were encountered: