Skip to content

Commit 05e4a79

Browse files
committed
Use module-minifier-webpack4-plugin in webpack 4 test projects.
1 parent 8892cd8 commit 05e4a79

File tree

9 files changed

+54
-6
lines changed

9 files changed

+54
-6
lines changed

build-tests-samples/heft-storybook-react-tutorial/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
"@rushstack/heft-typescript-plugin": "workspace:*",
2626
"@rushstack/heft-webpack4-plugin": "workspace:*",
2727
"@rushstack/heft": "workspace:*",
28+
"@rushstack/webpack4-module-minifier-plugin": "workspace:*",
2829
"@storybook/react": "~6.4.18",
2930
"@types/heft-jest": "1.0.1",
3031
"@types/node": "14.18.36",

build-tests-samples/heft-storybook-react-tutorial/webpack.config.js

+10-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
const path = require('path');
44
const HtmlWebpackPlugin = require('html-webpack-plugin');
5+
const { ModuleMinifierPlugin, WorkerPoolMinifier } = require('@rushstack/webpack4-module-minifier-plugin');
56

67
/**
78
* If the "--production" command-line parameter is specified when invoking Heft, then the
@@ -52,7 +53,15 @@ function createWebpackConfig({ production }) {
5253
new HtmlWebpackPlugin({
5354
template: 'assets/index.html'
5455
})
55-
]
56+
],
57+
optimization: {
58+
minimizer: [
59+
new ModuleMinifierPlugin({
60+
minifier: new WorkerPoolMinifier(),
61+
useSourceMap: true
62+
})
63+
]
64+
}
5665
};
5766

5867
return webpackConfig;

build-tests/heft-sass-test/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
"@rushstack/heft-typescript-plugin": "workspace:*",
1818
"@rushstack/heft-webpack4-plugin": "workspace:*",
1919
"@rushstack/heft": "workspace:*",
20+
"@rushstack/webpack4-module-minifier-plugin": "workspace:*",
2021
"@types/heft-jest": "1.0.1",
2122
"@types/react-dom": "16.9.14",
2223
"@types/react": "16.14.23",

build-tests/heft-sass-test/webpack.config.js

+10-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
const path = require('path');
44
const Autoprefixer = require('autoprefixer');
55
const HtmlWebpackPlugin = require('html-webpack-plugin');
6+
const { ModuleMinifierPlugin, WorkerPoolMinifier } = require('@rushstack/webpack4-module-minifier-plugin');
67

78
/**
89
* If the "--production" command-line parameter is specified when invoking Heft, then the
@@ -66,7 +67,15 @@ function createWebpackConfig({ production }) {
6667
new HtmlWebpackPlugin({
6768
template: 'assets/index.html'
6869
})
69-
]
70+
],
71+
optimization: {
72+
minimizer: [
73+
new ModuleMinifierPlugin({
74+
minifier: new WorkerPoolMinifier(),
75+
useSourceMap: true
76+
})
77+
]
78+
}
7079
};
7180

7281
return webpackConfig;

build-tests/localization-plugin-test-03/package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,10 @@
99
"_phase:build": "node build.js"
1010
},
1111
"dependencies": {
12-
"@rushstack/webpack4-localization-plugin": "workspace:*",
1312
"@rushstack/node-core-library": "workspace:*",
1413
"@rushstack/set-webpack-public-path-plugin": "workspace:*",
14+
"@rushstack/webpack4-localization-plugin": "workspace:*",
15+
"@rushstack/webpack4-module-minifier-plugin": "workspace:*",
1516
"@types/webpack-env": "1.18.0",
1617
"html-webpack-plugin": "~4.5.2",
1718
"ts-loader": "6.0.0",

build-tests/localization-plugin-test-03/webpack.config.js

+10-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ const { LocalizationPlugin } = require('@rushstack/webpack4-localization-plugin'
88
const { SetPublicPathPlugin } = require('@rushstack/set-webpack-public-path-plugin');
99
const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer');
1010
const HtmlWebpackPlugin = require('html-webpack-plugin');
11+
const { ModuleMinifierPlugin, WorkerPoolMinifier } = require('@rushstack/webpack4-module-minifier-plugin');
1112

1213
function resolveMissingString(localeNames, localizedResourcePath) {
1314
let contextRelativePath = path.relative(__dirname, localizedResourcePath);
@@ -140,7 +141,15 @@ function generateConfiguration(mode, outputFolderName) {
140141
}
141142
}),
142143
new HtmlWebpackPlugin()
143-
]
144+
],
145+
optimization: {
146+
minimizer: [
147+
new ModuleMinifierPlugin({
148+
minifier: new WorkerPoolMinifier(),
149+
useSourceMap: true
150+
})
151+
]
152+
}
144153
};
145154
}
146155

build-tests/set-webpack-public-path-plugin-webpack4-test/package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,12 @@
1010
},
1111
"devDependencies": {
1212
"@rushstack/eslint-config": "workspace:*",
13-
"@rushstack/heft": "workspace:*",
1413
"@rushstack/heft-lint-plugin": "workspace:*",
1514
"@rushstack/heft-typescript-plugin": "workspace:*",
1615
"@rushstack/heft-webpack4-plugin": "workspace:*",
16+
"@rushstack/heft": "workspace:*",
1717
"@rushstack/set-webpack-public-path-plugin": "workspace:*",
18+
"@rushstack/webpack4-module-minifier-plugin": "workspace:*",
1819
"@types/webpack-env": "1.18.0",
1920
"eslint": "~8.7.0",
2021
"html-webpack-plugin": "~4.5.2",

build-tests/set-webpack-public-path-plugin-webpack4-test/webpack.config.js

+10-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
const { SetPublicPathPlugin } = require('@rushstack/set-webpack-public-path-plugin');
44
const HtmlWebpackPlugin = require('html-webpack-plugin');
5+
const { ModuleMinifierPlugin, WorkerPoolMinifier } = require('@rushstack/webpack4-module-minifier-plugin');
56

67
function generateConfiguration(mode, outputFolderName) {
78
return {
@@ -21,7 +22,15 @@ function generateConfiguration(mode, outputFolderName) {
2122
}
2223
}),
2324
new HtmlWebpackPlugin()
24-
]
25+
],
26+
optimization: {
27+
minimizer: [
28+
new ModuleMinifierPlugin({
29+
minifier: new WorkerPoolMinifier(),
30+
useSourceMap: true
31+
})
32+
]
33+
}
2534
};
2635
}
2736

common/config/rush/pnpm-lock.yaml

+8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)