dynamic import are unrecognized in 3.0.0-next.b0cbf2ca, compile fails
See original GitHub issueIs this a bug report?
Yes
Did you try recovering your dependencies?
npm version
6.8.0
Which terms did you search for in User Guide?
Environment
I used the command, but I got an error instead. (node:16088) UnhandledPromiseRejectionWarning: Error: The system cannot find the path specified.
at Function.e.exports.sync (C:\Users\jonas\AppData\Roaming\npm\node_modules\create-react-app\node_modules\envinfo\dist\envinfo.js:1:7778)
at Object.copySync (C:\Users\jonas\AppData\Roaming\npm\node_modules\create-react-app\node_modules\envinfo\dist\envinfo.js:1:104976)
at Object.t.writeSync.e [as writeSync] (C:\Users\jonas\AppData\Roaming\npm\node_modules\create-react-app\node_modules\envinfo\dist\envinfo.js:1:123499)
at C:\Users\jonas\AppData\Roaming\npm\node_modules\create-react-app\node_modules\envinfo\dist\envinfo.js:1:124274 at Promise.all.then.e (C:\Users\jonas\AppData\Roaming\npm\node_modules\create-react-app\node_modules\envinfo\dist\envinfo.js:1:124289)
(node:16088) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwinginside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1) (node:16088) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
I’m on Windows 10
- node v11.8.0
- npm v6.8.0
- react-scripts v3.0.0-next.b0cbf2ca
- react & react-dom v16.8.1
Steps to Reproduce
(Write your steps here:)
- Create a new project with the latest prerelease (3.0.0-next.b0cbf2ca)
- Import a module dynamically (eg. const AsyncApp = lazy(() => import(‘./App’)))
- npm start -> Failed to compile
Expected Behavior
(Write what you thought would happen.) The build would pass, as it does in previous versions.
Actual Behavior
Reproducible Demo
(Paste the link to an example project and exact instructions to reproduce the issue.)
Issue Analytics
- State:
- Created 5 years ago
- Reactions:5
- Comments:32 (5 by maintainers)
Top GitHub Comments
I finally found a solution that works for me, suggested by @andybarsby and @kylehalleman
https://github.com/facebook/create-react-app/issues/6873#issuecomment-486205976
Running
npm i --save-dev acorn-dynamic-import@3
fixes the issue for me. No other solution have worked, I’ve tried all of these:npm install
Does updating the
acorn-dynamic-import
dependency solve the issue for anyone else? (for people, where the steps mentioned didn’t solve the issue)Thank you @joglr