create-react-app
create-react-app copied to clipboard
Dynamic imports not working when acorn has resolutions
Describe the bug
Dynamic imports are not working with any version of acorn specified in resolutions field in package.json.
Did you try recovering your dependencies?
Yes, my yarn version is 1.22.5.
Which terms did you search for in User Guide?
I think every possible one.
Environment
Environment Info:
current version of create-react-app: 4.0.2
running from /Users/ochdev/.npm/_npx/c67e74de0542c87c/node_modules/create-react-app
System:
OS: macOS 11.1
CPU: (16) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
Binaries:
Node: 15.8.0 - ~/.nvm/versions/node/v15.8.0/bin/node
Yarn: 1.22.5 - /usr/local/bin/yarn
npm: 7.5.1 - ~/.nvm/versions/node/v15.8.0/bin/npm
Browsers:
Chrome: 88.0.4324.146
Edge: Not Found
Firefox: 84.0
Safari: 14.0.2
npmPackages:
react: ^17.0.1 => 17.0.1
react-dom: ^17.0.1 => 17.0.1
react-scripts: 4.0.2 => 4.0.2
npmGlobalPackages:
create-react-app: Not Found
Steps to reproduce
(Write your steps here:)
- Create new project with
create-react-app - Add any version of
acorntoresolutionsfield inpackage.json - Install deps
yarnornpm i - Add any dynamic import to the project
- Start project
yarn startornpm run start - Go to
localhost:3000and see crashed app
Expected behavior
Dynamic imports should work as expected.
Actual behavior
Reproducible demo
https://github.com/ochmanski/cra-dynamic-import-acorn-res
Instructions are the same as cloning every new CRA project.
$ git clone [email protected]:ochmanski/cra-dynamic-import-acorn-res.git
$ yarn
$ yarn start
$ git clone [email protected]:ochmanski/cra-dynamic-import-acorn-res.git
$ npm i
$ npm run start
Any progress on this issue and i can replicate the same.