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

(chore) Switch to using SwcMinifyWebpackPlugin #826

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all 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
1 change: 1 addition & 0 deletions packages/framework/esm-framework/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
"jest": "^29.7.0",
"jest-cli": "^29.7.0",
"jest-environment-jsdom": "^29.7.0",
"swc-minify-webpack-plugin": "^2.1.1",
"webpack": "^5.88.0"
}
}
5 changes: 5 additions & 0 deletions packages/framework/esm-framework/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ const { resolve, basename } = require("path");
const { CleanWebpackPlugin } = require("clean-webpack-plugin");
const { BundleAnalyzerPlugin } = require("webpack-bundle-analyzer");
const { ModuleFederationPlugin } = require("webpack").container;
const { SwcMinifyWebpackPlugin } = require("swc-minify-webpack-plugin");

const { name, browser, main, peerDependencies } = require("./package.json");

Expand All @@ -18,6 +19,10 @@ module.exports = (env) => ({
library: { type: "system" },
},
devtool: "source-map",
optimization: {
minimize: true,
minimizer: [new SwcMinifyWebpackPlugin()],
},
module: {
rules: [
{
Expand Down
1 change: 1 addition & 0 deletions packages/framework/esm-styleguide/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@
"react": "^18.1.0",
"react-dom": "^18.1.0",
"rxjs": "^6.5.3",
"swc-minify-webpack-plugin": "^2.1.1",
"webpack": "^5.88.0"
}
}
3 changes: 2 additions & 1 deletion packages/framework/esm-styleguide/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ const CssMinimizerPlugin = require("css-minimizer-webpack-plugin");
const { resolve } = require("path");
const { BundleAnalyzerPlugin } = require("webpack-bundle-analyzer");
const { CleanWebpackPlugin } = require("clean-webpack-plugin");
const { SwcMinifyWebpackPlugin } = require("swc-minify-webpack-plugin");

const { peerDependencies } = require("./package.json");

Expand Down Expand Up @@ -65,7 +66,7 @@ module.exports = (env) => ({
},
optimization: {
minimize: true,
minimizer: [new CssMinimizerPlugin(), "..."],
minimizer: [new CssMinimizerPlugin(), new SwcMinifyWebpackPlugin()],
},
plugins: [
new CleanWebpackPlugin(),
Expand Down
1 change: 1 addition & 0 deletions packages/tooling/openmrs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
"postcss-loader": "^6.2.1",
"rimraf": "^3.0.2",
"swc-loader": "^0.2.3",
"swc-minify-webpack-plugin": "^2.1.1",
"tar": "^6.0.5",
"typescript": "^4.6.4",
"webpack": "^5.88.0",
Expand Down
1 change: 1 addition & 0 deletions packages/tooling/webpack-config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
"sass-loader": "^12.3.0",
"style-loader": "^3.3.1",
"swc-loader": "^0.2.3",
"swc-minify-webpack-plugin": "^2.1.1",
"webpack": "^5.88.0",
"webpack-bundle-analyzer": "^4.5.0",
"webpack-stats-plugin": "^1.0.3"
Expand Down
5 changes: 4 additions & 1 deletion packages/tooling/webpack-config/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ import {
} from "webpack";
import { BundleAnalyzerPlugin } from "webpack-bundle-analyzer";
import { StatsWriterPlugin } from "webpack-stats-plugin";
import { SwcMinifyWebpackPlugin } from "swc-minify-webpack-plugin";
// eslint-disable-next-line no-restricted-imports
import { merge, mergeWith, isArray } from "lodash";
import { existsSync, statSync } from "fs";
Expand Down Expand Up @@ -274,7 +275,9 @@ export default (
maxAsyncRequests: 3,
maxInitialRequests: 1,
},
},
minimize: true,
minimizer: [new SwcMinifyWebpackPlugin()],
} as WebpackConfiguration["optimization"],
optimizationConfig
),
plugins: [
Expand Down
14 changes: 14 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2916,6 +2916,7 @@ __metadata:
jest: "npm:^29.7.0"
jest-cli: "npm:^29.7.0"
jest-environment-jsdom: "npm:^29.7.0"
swc-minify-webpack-plugin: "npm:^2.1.1"
webpack: "npm:^5.88.0"
peerDependencies:
dayjs: 1.x
Expand Down Expand Up @@ -3139,6 +3140,7 @@ __metadata:
react: "npm:^18.1.0"
react-dom: "npm:^18.1.0"
rxjs: "npm:^6.5.3"
swc-minify-webpack-plugin: "npm:^2.1.1"
webpack: "npm:^5.88.0"
peerDependencies:
"@openmrs/esm-extensions": 5.x
Expand Down Expand Up @@ -3181,6 +3183,7 @@ __metadata:
sass-loader: "npm:^12.3.0"
style-loader: "npm:^3.3.1"
swc-loader: "npm:^0.2.3"
swc-minify-webpack-plugin: "npm:^2.1.1"
typescript: "npm:^4.6.4"
webpack: "npm:^5.88.0"
webpack-bundle-analyzer: "npm:^4.5.0"
Expand Down Expand Up @@ -12963,6 +12966,7 @@ __metadata:
postcss-loader: "npm:^6.2.1"
rimraf: "npm:^3.0.2"
swc-loader: "npm:^0.2.3"
swc-minify-webpack-plugin: "npm:^2.1.1"
tar: "npm:^6.0.5"
typescript: "npm:^4.6.4"
webpack: "npm:^5.88.0"
Expand Down Expand Up @@ -16020,6 +16024,16 @@ __metadata:
languageName: node
linkType: hard

"swc-minify-webpack-plugin@npm:^2.1.1":
version: 2.1.1
resolution: "swc-minify-webpack-plugin@npm:2.1.1"
peerDependencies:
"@swc/core": ^1.0.0
webpack: ^5.0.0
checksum: 700b763bda9d77882b36600f14bf1859c9bd44a6953a7c0ae4ad4c21a924f2993427ca1d6c83a5dd502309d84009ead873d4033ac050718959f84a9e552df0b4
languageName: node
linkType: hard

"swr@npm:^2.2.2":
version: 2.2.2
resolution: "swr@npm:2.2.2"
Expand Down
Loading