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

Restrict css-minimizer-webpack-plugin version in the generator unless using Node v18+ #1598

Merged
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ Please follow the recommendations outlined at [keepachangelog.com](http://keepac
### [Unreleased]
Changes since the last non-beta release.

#### Fixed
- Limit `css-minimizer-webpack-plugin` version below v6.0.0, allowing the react_on_rails generator to work in environments with Nodejs < 18 [PR 1598](https://github.com/shakacode/react_on_rails/pull/1598) by [ahangarha](https://github.com/ahangarha).

#### Changed
- Bump minimum version of peer dependencies as following [PR 1596](https://github.com/shakacode/react_on_rails/pull/1596) by [ahangarha](https://github.com/ahangarha).
- `js-yaml` to `4.1.0`
Expand Down
3 changes: 2 additions & 1 deletion lib/generators/react_on_rails/base_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,8 @@ def add_yarn_dependencies
babel-plugin-macros"

puts "Adding CSS handlers"
run "yarn add css-loader css-minimizer-webpack-plugin mini-css-extract-plugin style-loader"
# css-minimizer-webpack-plugin v6.0.0 requires Node 18+
Copy link
Member

@justin808 justin808 Jan 21, 2024

Choose a reason for hiding this comment

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

This is 100% the wrong thing to do. We should not be doing things like this to fix testing...Instead, just take Node 16 out of the test matrix.

We're not requiring an update to Node. Node 16 should still work with React on Rails.

Please confirm that the error is easy to debug if somebody uses the generator with old Node.

Copy link
Contributor

Choose a reason for hiding this comment

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

@ahangarha you could actually make the version of css-minimizer-webpack-plugin installed conditional on the version of node that is being used.

Have the generator check the result of node -v & then install the latest version of css-minimizer-webpack-plugin compatible with that node version.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sounds better 👍🏾

run "yarn add css-loader 'css-minimizer-webpack-plugin@<6.0.0' mini-css-extract-plugin style-loader"

puts "Adding dev dependencies"
run "yarn add -D @pmmmwh/react-refresh-webpack-plugin react-refresh"
Expand Down
Loading