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, prepare for webpack 5 #4146

Closed
wants to merge 15 commits into from
Closed

Update js dependencies, prepare for webpack 5 #4146

wants to merge 15 commits into from

Conversation

skovmand
Copy link
Contributor

@skovmand skovmand commented Jan 10, 2021

This PR updates all javascript dependencies to their newest versions, but also removes and changes some of them to prepare for upgrading to webpack 5.

Dependency changes:

Other changes:

  • Several webpack plugins now require Node.js 10.13. I have updated the minimum Node.js version in installation.md
  • Node.js is spelled differently across Phoenix as e.g. "node", "NodeJS", "Node.JS", etc, but the correct spelling is Node.js. This is corrected across the project (Update: This has been done in Use consistent naming of Node.js in docs #4150)

I have created a new phx_new package locally and verified that I can install a new phoenix project with these updated packages, and that the iex -S mix phx.server runs.

I haven't verified that it works with releases yet.

Notes on warnings:

Currently we get a lot of warnings during npm install:

npm WARN deprecated chokidar@2.1.8: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated fsevents@1.2.13: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.

As I understand it, these errors will be fixed in webpack 5, and we can't do anything about them before upgrading to webpack 5. chokidar@2.1.8, resolve-url@0.2.1, urix@0.1.0, fsevents@1.2.13 are all dependencies of webpack@4.45.0.

The path ahead

This PR paves the way for upgrading to webpack 5, by removing some plugins and updating others to versions compatible with webpack 5. Also, updating to webpack 5 should fix the above deprecations.

Should we wait until Phoenix 1.6 with an upgrade to webpack 5, or would it be ok to include it in Phoenix 1.5?

@skovmand
Copy link
Contributor Author

skovmand commented Jan 10, 2021

Okay, I just discovered that there is already a PR for updating to webpack 5 here with a lot of discussion. I didn't see that before making this. Let me know if I should close this PR again, that is 👍

However this PR is different in remaining on webpack 4 to prepare for webpack 5 and to hopefully make the webpack 5 upgrade step smaller. So perhaps this could be useful if the webpack 5 upgrade will not happen for a while.

@skovmand
Copy link
Contributor Author

Also, I think we also need to update the topbar dependency for LiveViews

@henrik
Copy link
Contributor

henrik commented Jan 12, 2021

(Not a maintainer, just another contributor.) The "Node.js" naming consistency fixes seems like a fairly separate fix that could perhaps be merged independent of that other PR (and this one) – could it make sense to make that into a separate PR?

@skovmand
Copy link
Contributor Author

skovmand commented Jan 13, 2021

Good suggestion! Done in #4150
I have removed the Node.js renaming from this PR by force-pushing just now

@cw789 cw789 mentioned this pull request Jan 31, 2021
- Major version 6 is the last one to support webpack 4
- Minimum supported Node.js version is 10.13
- Changelog: https://github.com/webpack-contrib/copy-webpack-plugin/blob/v6.4.1/CHANGELOG.md
The node-sass module is deprecated and sass-loader recommends using dart-sass instead, https://github.com/webpack-contrib/sass-loader
- It makes asset compilation crash when used with latest mini-css-extract-plugin
- HardSourceWebpackPlugin is no longer needed with Webpack 5: mzgoddard/hard-source-webpack-plugin#514 (comment)
@skovmand
Copy link
Contributor Author

I just force-pushed on top of the current v1.5 branch to:

  • fix merge conflicts
  • update all js deps to latest minor versions compatible with webpack 4
  • change double-quotes to single quotes in webpack.config.js
  • also update topbar from 0.1.4 to 1.0.1

@skovmand
Copy link
Contributor Author

skovmand commented Feb 17, 2021

This is strange: My diff on GitHub is confusing for this commit: 08dd8b4 .. It shows changes to

<%= if html do %>

and

<% end %><%= if live do %>

But my local git commit shows no changes. 🤔

@skovmand
Copy link
Contributor Author

skovmand commented Feb 17, 2021

If you choose to go with #4054, just let me know, I will close this PR.

Also if I should move change from node-sass to sass into another PR, also let me know 🙂 (update: I just saw that sass is currently used on the master branch).

@skovmand skovmand closed this Mar 22, 2021
@skovmand skovmand reopened this Mar 22, 2021
@skovmand
Copy link
Contributor Author

Is there interest in going forward with this PR? If so, please let me know, and I'll bump the dependencies to their newest versions.

I'll close the PR in a week if there's no activity on it.

@chrismccord
Copy link
Member

I have a large backlog of other items. Hang tight. Thanks! :)

@skovmand
Copy link
Contributor Author

@chrismccord Thanks, and thank you for your work! Please let me know if there are things that will make review and merge of the PR easier at your end. I'm happy to help ☀️

@chrismccord
Copy link
Member

We have tacked webpack v5 support in #4337 . Thank you for the leg work on this! ❤️❤️❤️🐥🔥

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

4 participants