Skip to content
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

Update webpack to fix dynamic imports #7254

Closed
cinnamonKale opened this issue Jun 20, 2019 · 14 comments · Fixed by #7257
Closed

Update webpack to fix dynamic imports #7254

cinnamonKale opened this issue Jun 20, 2019 · 14 comments · Fixed by #7257

Comments

@cinnamonKale
Copy link

In v3.0.1, using webpack@4.29.6, dynamic imports fail. See the issue here. The issue's been fixed since 4.30.0, with the latest current version at 4.35.0

When will react-scripts be updated with the fixed version of webpack? I imagine it's a simple dependency update, but I don't know how the latest version will affect CRA

@bugzpodder bugzpodder added this to the 3.0.2 milestone Jun 20, 2019
@iansu
Copy link
Contributor

iansu commented Jun 21, 2019

I didn't realize this issue had been fixed in webpack. Thanks for pointing that out. We'll try and get a new version released in the next few days, provided the webpack upgrade doesn't introduce any other issues.

@mrmckeb
Copy link
Contributor

mrmckeb commented Jun 24, 2019

In case anyone comes across this issue, this won't affect new installs.

If you have an existing install you can try removing node_modules and your lock file, then reinstalling. This will give you the latest Webpack version.

@lucamartini
Copy link

lucamartini commented Jun 26, 2019

In case anyone comes across this issue, this won't affect new installs.

If you have an existing install you can try removing node_modules and your lock file, then reinstalling. This will give you the latest Webpack version.

This does not work for our project, the problem is till there.
Downgrading to "react-scripts": "^2.1.8" works,
So we are waiting there, until the next CRA release.

@mrmckeb
Copy link
Contributor

mrmckeb commented Jun 27, 2019

This should work @lucamartini, did you check what Webpack version you had installed?

@lucamartini
Copy link

lucamartini commented Jun 27, 2019

it works with yarn, but not with npm.
@mrmckeb this is webpack after a new install:
react-scripts@3.0.1
└── webpack@4.29.6

@mrmckeb
Copy link
Contributor

mrmckeb commented Jul 1, 2019

That's interesting. And not what I would have expected... it's not ideal, but you could also update package-lock.json to point to the latest version. We're working on the next version now.

@iansu, this might warrant a quick patch-release.

@markerikson
Copy link

I created a new CRA+TS project a couple days ago. I got react-scripts@3.0.1, and it also explicitly points to webpack@4.29.6, using Yarn 1.16.

Any news on getting this out as an update?

@bugzpodder
Copy link

@markerikson it should be next week.

@Tobbe
Copy link

Tobbe commented Jul 27, 2019

Warning: Dirty dirty solution below

This is what I did to temporarily solve this issue

In the root of my CRA project:

$ npm install webpack # This gave me webpack@4.38.0
$ rm -fr node_modules/react-scripts/node_modules/webpack/*
$ cp -r node_modules/webpack/* node_modules/react-scripts/node_modules/webpack/
$ vim node_modules/react-scripts/package.json # Change  "webpack": "4.29.6",  ->  "webpack": "4.38.0",

The last step is needed for CRA's preflight check to pass

@markerikson
Copy link

Or use Yarn's "resolutions" to force the use of an updated Webpack version:

https://yarnpkg.com/lang/en/docs/selective-version-resolutions/

@Tobbe
Copy link

Tobbe commented Aug 4, 2019

Had to automate this step for our CI setup. Added a "postinstall" script to package.json

  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject",
    "postinstall": "rm -fr node_modules/react-scripts/node_modules/webpack/* && cp -r node_modules/webpack/* node_modules/react-scripts/node_modules/webpack/ && sed -i -e 's/\"webpack\": \"4.29.6\"/\"webpack\": \"4.39.0\"/' ./node_modules/react-scripts/package.json"
  },

@mrmckeb
Copy link
Contributor

mrmckeb commented Aug 5, 2019

@Tobbe, you shouldn't need to do that. Are you in npm or Yarn?

@Tobbe
Copy link

Tobbe commented Aug 5, 2019

@mrmckeb I'm using npm

$ node -v
v12.7.0
$ npm -v
6.10.0

@iansu
Copy link
Contributor

iansu commented Aug 7, 2019

This is fixed and will be released in 3.1 so I'm going to close this issue.

@iansu iansu closed this as completed Aug 7, 2019
@lock lock bot locked and limited conversation to collaborators Aug 12, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants