-
Notifications
You must be signed in to change notification settings - Fork 57
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 'Component' from non EcmaScript module #399
Comments
@linmingren Are you using Webpack, or what is the build tool? Is the error coming from the build or do you see it in the browser console? It will be easier to debug this if you're able to make a minimal reproduction app and post it publicly. |
My steps:
|
My package.json: { |
@linmingren Thanks for the steps. The issue is because create-react-app uses Webpack 4 now, which tries to load The good news is that there is a workaround, a way to adjust the default First, install the Then, in
Finally, paste this into a file in the project root directory named module.exports = function override(webpackConfig) {
webpackConfig.module.rules.push({
test: /\.mjs$/,
include: /node_modules/,
type: "javascript/auto"
});
return webpackConfig;
} Now If you get an error about missing |
I filed the |
@aldeed Hi, your solution really works! Thanks! |
🎉 This issue has been resolved in version 0.64.1 🎉 The release is available on: Your semantic-release bot 📦🚀 |
For anyone searching for a solution using // config-overrides.js
const { override } = require("customize-cra");
const supportMjs = () => (webpackConfig) => {
webpackConfig.module.rules.push({
test: /\.mjs$/,
include: /node_modules/,
type: "javascript/auto",
});
return webpackConfig;
};
module.exports = override(
supportMjs()
); |
Thanks @danilofuchs this worked for me.
|
This issue is the top Google result for "Can't import the named export..." and is referenced by StackOverflow here. Can you speak more to this statement?
The provided solution works. Where is the bug here? Is the problem that |
This worked for me, thanks a bunch... took me a week before i came across this solution |
@aldeed It works with these changes. |
Thanks very much! This worked for me. |
Thank you so much bro, it worked. |
Describe the bug
./node_modules/@reactioncommerce/components/InPageMenuItem/v1/InPageMenuItem.mjs
Can't import the named export 'Component' from non EcmaScript module (only default export is available)
To Reproduce
import InPageMenuItem from "@reactioncommerce/components/InPageMenuItem/v1"
Desktop (please complete the following information):
The text was updated successfully, but these errors were encountered: