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 js dependencies #2428

Merged
merged 4 commits into from
Mar 20, 2020
Merged

Update js dependencies #2428

merged 4 commits into from
Mar 20, 2020

Conversation

pustovalov
Copy link
Contributor

@pustovalov pustovalov commented Jan 7, 2020

@pustovalov
Copy link
Contributor Author

I'd rather switch from 8.16.0 to 12.14.1. This is current LTS version

Active LTS Start - 2019-10-21

WDYT?

@pustovalov pustovalov force-pushed the js-dep branch 2 times, most recently from cbc2d8e to 032d937 Compare January 7, 2020 23:22
@jakeNiemiec
Copy link
Member

Just a few questions. Why is terser under resolutions? "terser-webpack-plugin": "^2.3.1"

Should we avoid wrapping breaking changes in a commit like "Update js dependencies". Remember that users can fine-tune the loaders in environment.js. This is unlikely, but it has happened with other loaders in the past couple months.

@pustovalov
Copy link
Contributor Author

pustovalov commented Jan 8, 2020

Just a few questions. Why is terser under resolutions? "terser-webpack-plugin": "^2.3.1"

Webpacker use "terser-webpack-plugin": "^2.3.1"
https://github.com/rails/webpacker/blob/master/package.json#L48

And webpack has this dependency:
terser-webpack-plugin "^1.4.3"
https://github.com/rails/webpacker/blob/master/yarn.lock#L8101

a separate dependency was introduced in this commit

0d36af9#diff-b9cfc7f2cdf78a7f4b91a753d10865a2L42

and then updated in this commit

13756f1#diff-b9cfc7f2cdf78a7f4b91a753d10865a2L48

as a result, we have two terser-webpack-plugin:
1.4.3
https://github.com/rails/webpacker/blob/master/yarn.lock#L7615

2.3.1
https://github.com/rails/webpacker/blob/master/yarn.lock#L7630

I think terser-webpack-plugin will not be updated for webpack 4, because:

https://github.com/webpack-contrib/terser-webpack-plugin/blob/master/CHANGELOG.md#-breaking-changes

2.0.0 (2019-09-05)
⚠ BREAKING CHANGES
minimum require Node.js version is 8.9.0

Webpack 4 supporting node >= 6.11
https://github.com/webpack/webpack/blob/webpack-4/package.json#L87

I use resolutions for terser-webpack-plugin with webpacker in my project, and all works fine

@pustovalov
Copy link
Contributor Author

pustovalov commented Jan 8, 2020

Remember that users can fine-tune the loaders in environment.js

yea, but webpacker in default configuration does not use those parameters that were changed.

I think with the version update for Node.js, because

The Node.js 8.x Maintenance LTS cycle will expire on December 31, 2019 
- which means that Node 8 won’t get any more updates, bug fixes or security patches.

https://blog.risingstack.com/update-nodejs-8-end-of-life-no-support/

and also with this PR: #2415

We can also update and loaders

package.json Outdated
"jest": "^24.9.0"
},
"resolutions": {
"terser-webpack-plugin": "^2.3.1"
},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as a result, we have two terser-webpack-plugin ... I think terser-webpack-plugin will not be updated for webpack 4

It is ok that we have 2 versions of terser. Webpack needs to use the version of terser that it was built to support. There is no need to micromanage the lock file 👍.

package.json Outdated
@@ -43,22 +43,25 @@
"postcss-preset-env": "^6.7.0",
"postcss-safe-parser": "^4.0.1",
"regenerator-runtime": "^0.13.3",
"sass-loader": "7.3.1",
"style-loader": "^1.0.0",
"sass-loader": "^8.0.0",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yea, but webpacker in default configuration does not use those parameters that were changed...We can also update and loaders

This will break things for users that chose to use those parameters since we can only update loaders in our own codebase. We could have changelog entry that informs users how to migrate their environment.js, but this would need to be a breaking change.

@@ -8,31 +8,31 @@
"lib/install/config/webpacker.yml"
],
"engines": {
"node": ">=8.16.0",
"node": ">=10.13.0",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think with the version update for Node.js because...

👍 I agree with this part

jakeNiemiec
jakeNiemiec previously approved these changes Jan 10, 2020
Copy link
Member

@jakeNiemiec jakeNiemiec left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for those changes.

Copy link
Contributor

@kimyu92 kimyu92 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there anything that I can help out to push this through the pipeline?

package.json Outdated Show resolved Hide resolved
package.json Outdated
"terser-webpack-plugin": "^2.3.4",
"webpack": "^4.41.3",
"webpack": "^4.41.5",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @gauravtiwari, does it make sense to support this PR? Maybe it would be better to break it into smaller ones?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @pustovalov Yep it does. I was just concerned if there is going to be any breaking changes? I guess everything looks good except file loader node version requirements? https://github.com/webpack-contrib/file-loader/releases/tag/v5.0.0

Thanks for working on this and sorry about the delay.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you are right, looks like breaking change only in file-loader

@gauravtiwari
Copy link
Member

If you could double check this and update. I will merge and make a release later today 👍

Thank you all 🙏

@gauravtiwari gauravtiwari merged commit b033d55 into rails:master Mar 20, 2020
@gauravtiwari
Copy link
Member

thanks @pustovalov

@amoshydra
Copy link
Contributor

This PR bumped file-loader version from 4 to 5 which

switch to ES modules by default (the option esModule is true by default)
-- https://github.com/webpack-contrib/file-loader/blob/2a18cba98f1e4bd64734791a657e8acff4b11fac/CHANGELOG.md

This broke asset loading mentioned in #2613

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants