-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
build(ui): upgrade to Webpack v5 + upgrade loaders + plugins #11628
Merged
terrytangyuan
merged 3 commits into
argoproj:master
from
agilgur5:build-upgrade-webpack
Aug 23, 2023
Merged
build(ui): upgrade to Webpack v5 + upgrade loaders + plugins #11628
terrytangyuan
merged 3 commits into
argoproj:master
from
agilgur5:build-upgrade-webpack
Aug 23, 2023
Commits on Aug 20, 2023
-
build(ui): upgrade to Webpack v5 + upgrade loaders + plugins
- upgrade `webpack` and `webpack-cli` to latest major v5 - (`webpack-dev-server` does not have a v5, is already at latest major) - fix config errors and deprecation warnings: - `[hash]` -> `[contenthash]` (https://webpack.js.org/migrate/5/#clean-up-configuration) - `contenthash` is just a better hash, as it is calculated per entrypoint instead for the entire bundle - that being said, we only have one entrypoint, so not super relevant. but `hash` was also deprecated - also same as [Argo CD config](https://github.com/argoproj/argo-cd/blob/6ca2e90b5094eba3878746fee5f2c357bfbc6cb8/ui/src/app/webpack.config.js#L20) - `node.fs: "empty"` -> `resolve.fallback.fs: false` (https://webpack.js.org/migrate/5/#clean-up-configuration) - also same as [Argo CD config](https://github.com/argoproj/argo-cd/blob/6ca2e90b5094eba3878746fee5f2c357bfbc6cb8/ui/src/app/webpack.config.js#L28) - `loaders` -> `use` (https://webpack.js.org/migrate/5/#update-outdated-options) - `!` syntax for chaining loaders has been fully removed as well. replaced by using arrays - upgrade `HtmlWebpackPlugin` and `CopyWebpackPlugin` to latest major: - `html-webpack-plugin` to v5's main [breaking changes](https://github.com/jantimon/html-webpack-plugin/blob/v5.5.3/CHANGELOG.md#500-2021-02-03) are to drop support for Webpack v4 and Node <= 10 - `copy-webpack-plugin` to v11 has some options changes as well as Webpack and Node support drops: - [v6](https://github.com/webpack-contrib/copy-webpack-plugin/blob/v11.0.0/CHANGELOG.md#600-2020-05-15) changes to use `patterns: [...]` - same syntax as [Argo CD config](https://github.com/argoproj/argo-cd/blob/6ca2e90b5094eba3878746fee5f2c357bfbc6cb8/ui/src/app/webpack.config.js#L72) - [v7](https://github.com/webpack-contrib/copy-webpack-plugin/blob/v11.0.0/CHANGELOG.md#700-2020-12-10) drops support for Webpack v4 - [v8](https://github.com/webpack-contrib/copy-webpack-plugin/blob/v11.0.0/CHANGELOG.md#800-2021-03-04) does not impact our usage - v9-[v11](https://github.com/webpack-contrib/copy-webpack-plugin/blob/v11.0.0/CHANGELOG.md#1100-2022-05-17) drop support for older Node, now requiring Node >= 14.15.0 - no changes needed to `DefinePlugin` - `MonacoEditorWebpackPlugin` is being upgraded in a separate PR/commit - upgrade `style-loader` and `sass-loader` to latest major: - `style-loader`'s main breaking changes are dropping support for Webpack v4 and old Node versions: - [v1](https://github.com/webpack-contrib/style-loader/blob/v3.3.3/CHANGELOG.md#100-2019-08-06) drops support for Webpack < v4, Node < 8.9.0, and otherwise does not impact our usage - [v2](https://github.com/webpack-contrib/style-loader/blob/v3.3.3/CHANGELOG.md#200-2020-10-09) drops support for Node < 10.13.0 and otherwise does not impact our usage - [v3](https://github.com/webpack-contrib/style-loader/blob/v3.3.3/CHANGELOG.md#300-2021-06-24) drops support for Webpack v4, Node < 12.13.0, and otherwise does not impact our usage - `sass-loader`'s main breaking changes are dropping support for Webpack v4 and old Node versions: - [v11](https://github.com/webpack-contrib/sass-loader/blob/v13.3.2/CHANGELOG.md#1100-2021-02-05) drops support for Webpack v4 - v12-[v13](https://github.com/webpack-contrib/sass-loader/blob/v13.3.2/CHANGELOG.md#1300-2022-05-18) drop support for older Node, now requiring Node >= 14.15.0 - did not touch `raw-loader` or `file-loader` as both are [deprecated in Webpack v5](https://webpack.js.org/guides/asset-modules/) - can replace these with native alternatives in a future PR - no deprecation warnings from these right now - did not touch `source-map-loader`, `react-hot-loader`, `babel-loader`, or `ts-loader` as I'd like to replace these with `esbuild-loader` - as it would be much faster, still serves our minimal config needs, and matches [Argo CD config](https://github.com/argoproj/argo-cd/blob/6ca2e90b5094eba3878746fee5f2c357bfbc6cb8/ui/src/app/webpack.config.js#L37) - `react-hot-loader` is also [deprecated](https://github.com/gaearon/react-hot-loader#moving-towards-next-step) - no deprecation warnings from these right now - also change some single quotes to double quotes in the config for consistency (`'` -> `"`) Signed-off-by: Anton Gilgur <agilgur5@gmail.com>
Configuration menu - View commit details
-
Copy full SHA for 6960009 - Browse repository at this point
Copy the full SHA 6960009View commit details -
chore(deps): remove forced resolution for
react-toastify
- this is no longer necessary with Webpack v5 Signed-off-by: Anton Gilgur <agilgur5@gmail.com>
Configuration menu - View commit details
-
Copy full SHA for 1122786 - Browse repository at this point
Copy the full SHA 1122786View commit details
Commits on Aug 21, 2023
-
chore(deps): further update asset loaders
- `raw-loader`'s main breaking changes are dropping support for Webpack <v4 and old Node versions: - [v1](https://github.com/webpack-contrib/raw-loader/blob/v4.0.2/CHANGELOG.md#100-2018-12-10) drops support for Webpack < v4 and Node < 6.9 - [v2](https://github.com/webpack-contrib/raw-loader/blob/v4.0.2/CHANGELOG.md#200-2019-03-18) does not seem to impact our usage - [v3](https://github.com/webpack-contrib/raw-loader/blob/v4.0.2/CHANGELOG.md#300-2019-06-05) drops support for Node < 8.9.0 - [v4](https://github.com/webpack-contrib/raw-loader/blob/v4.0.2/CHANGELOG.md#400-2019-11-25) drops support for Node < 10.13.0 - I was not able to swap `raw-loader` for built-in Webpack v5 asset loading as it is an in-between loader - it would have to be replaced by `css-loader`, effectively, but doing that causes Webpack to fail to find assets from `argo-ui` etc - using `resolve-url-loader` or other trial-and-error attempts did not fix that either; not really sure why it's failing - swap `file-loader` for built-in Webpack v5 `asset/resouce` loading - downgrade `style-loader` to v1 - [v2](https://github.com/webpack-contrib/style-loader/blob/v3.3.3/CHANGELOG.md#200-2020-10-09)'s breaking change in webpack-contrib/style-loader@7a0ce4c appears to break our usage - I believe this is because the chained `raw-loader` returns a String and not an Array. Updating `raw-loader` did not fix this (and its latest version is older than `style-loader` v2 as well) - this didn't cause a build error, but it caused styles to fail to load on render instead Signed-off-by: Anton Gilgur <agilgur5@gmail.com>
Configuration menu - View commit details
-
Copy full SHA for dec7d8b - Browse repository at this point
Copy the full SHA dec7d8bView commit details
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.