-
-
Notifications
You must be signed in to change notification settings - Fork 26.9k
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
.mjs node module not working after eject #3520
Comments
Should've mentioned that this was originally implemented in #3237 |
So does |
Is anyone working on this? If not then I'd like to look into it. |
Go ahead @iansu |
Didn't have time to go after this earlier. If I rename a .js file that I include to a .jsx then I end up with the same error as in my original report. If I then change the |
This is out in |
Is this a bug report?
Yes
Can you also reproduce the problem with npm 4.x?
Unsure, using yarn 0.27.5
Which terms did you search for in User Guide?
webkit, constructor
Uncaught TypeError: __WEBPACK_IMPORTED_MODULE_1_universal_router___default.a is not a constructor
Environment
node -v
: v8.2.1npm -v
: 5.3.0yarn --version
(if you use Yarn): 0.27.5npm ls react-scripts
(if you haven’t ejected): [ejected]Then, specify:
Chrome Version 62.0.3202.94 (Official Build) (64-bit)
Steps to Reproduce
(Write your steps here:)
yarn add universal-router
)Expected Behavior
The console output should show that UniversalRouter is a proper constructor function and no errors should occur.
Actual Behavior
The console outputs
/static/media/browser.99d6d764.mjs
and the following error is shown:TypeError: __WEBPACK_IMPORTED_MODULE_1_universal_router___default.a is not a constructor
Possible fix
I found that the following fixed this for me:
On line 201 of the generated
webpack.config.dev.js
replace:exclude: [/\.js$/, /\.html$/, /\.json$/],
with
exclude: [/\.m?js$/, /\.html$/, /\.json$/],
This might also need to be done for the .prod version.
The text was updated successfully, but these errors were encountered: