-
-
Notifications
You must be signed in to change notification settings - Fork 940
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
Can't import the named export 'c' from non EcmaScript module (only default export is available)
under CRA v4
#1051
Comments
Last working version is issue! Thank you for your report, now I assume something is broken inside the build of esm via esbuild. @evanw do you have some insides for this? |
I'm not sure this is related to that other issue. I'll note a few things.
|
There is a similar issue when using the latest faker with cypress (which might be one of the big use cases): cypress-io/cypress#21874 (comment) |
I found out that your stackblitz repro depends on |
This is an issue specifically with Faker and Webpack 4, which is used by CRAv4. Upgrading the project to Webpack v5 would require upgrading CRA to v5.
MoSattler seem's to have a similar issue because Cypress also seems to be using Webpack v4. Webpack v5 is very different than v4, it can require a large refactor of imports, and the plugin API system changed requiring a variety of config changes to replace plugins that previously worked. So I can understand it not being simple to just drop v5 in place of v4. |
As a solution, you can just process |
Having the same issue with Cypress and Storybook. Cypress preprocessor doesn't seem to work at all for me. |
For example, for Storybook (Webpack 4) I have this change: // .../.storybook/main.js
module.exports = {
...,
webpackFinal: async (config) => {
// The first rule in `rules` property is configuring babel loader.
// So I just change its `exclude` option from `/node_modules/`
// to "folder 'node_modules' except of 'node_modules/@faker-js/'"
config.module.rules[0].exclude = /node_modules(\/|\\)(?!@faker-js(\/|\\)).*/
...
return config
},
} |
closed by #1085 |
@dantman @MoSattler @Semigradsky @marco2216 Please checkout the newest version https://github.com/faker-js/faker/releases/tag/v7.3.0 |
Describe the bug
When trying to use faker 7.2.0 under CRA v4 you get the following error:
Can't import the named export 'c' from non EcmaScript module (only default export is available)
Reproduction
@faker-js/faker@7.2.0
@faker-js/faker
into the apphttps://stackblitz.com/edit/node-8dkswx?file=src/index.js
Additional Info
No response
The text was updated successfully, but these errors were encountered: