Skip to content

Commit

Permalink
build: update webpack to v5 (#519)
Browse files Browse the repository at this point in the history
* build: update webpack to v5
  • Loading branch information
shadowusr authored Nov 7, 2023
1 parent 512fb03 commit 5fd52d4
Show file tree
Hide file tree
Showing 9 changed files with 3,072 additions and 9,539 deletions.
12,360 changes: 2,965 additions & 9,395 deletions package-lock.json

Large diffs are not rendered by default.

29 changes: 17 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -115,22 +115,23 @@
"@typescript-eslint/eslint-plugin": "^5.60.0",
"@typescript-eslint/parser": "^5.60.0",
"app-module-path": "^2.2.0",
"babel-loader": "^8.3.0",
"babel-loader": "^9.1.3",
"chai": "^4.1.2",
"chai-as-promised": "^7.1.1",
"classnames": "^2.2.5",
"concurrently": "^7.6.0",
"conventional-changelog-lint": "^1.0.1",
"copyfiles": "^2.4.1",
"cross-env": "^5.2.0",
"css-loader": "^0.28.7",
"css-minimizer-webpack-plugin": "^1.3.0",
"crypto-browserify": "^3.12.0",
"css-loader": "^6.8.1",
"css-minimizer-webpack-plugin": "^5.0.1",
"enzyme": "^3.11.0",
"enzyme-adapter-react-16": "^1.15.4",
"eslint": "^8.43.0",
"eslint-config-gemini-testing": "^2.8.0",
"eslint-plugin-react": "^7.32.2",
"fork-ts-checker-webpack-plugin": "^6.5.3",
"fork-ts-checker-webpack-plugin": "^9.0.0",
"hermione": "^8.0.0-beta.2",
"hermione-global-hook": "^1.0.1",
"hermione-test-repeater": "^0.0.8",
Expand All @@ -142,18 +143,20 @@
"html-reporter-test-server": "file:test/func/packages/html-reporter-test-server",
"html-reporter-tester": "file:test/func/packages/html-reporter-tester",
"html-webpack-include-assets-plugin": "^1.0.2",
"html-webpack-plugin": "^4.5.2",
"html-webpack-plugin": "^5.5.3",
"html-webpack-tags-plugin": "^3.0.2",
"husky": "^0.11.9",
"ignore-styles": "^5.0.1",
"immer": "^7.0.15",
"jsdom": "^21.1.2",
"jsdom-global": "^3.0.2",
"less": "^3.11.1",
"less-loader": "^5.0.0",
"mini-css-extract-plugin": "^1.6.2",
"less-loader": "^11.1.3",
"mini-css-extract-plugin": "^2.7.6",
"mocha": "^10.2.0",
"npm-run-all": "^4.1.5",
"nyc": "^14.1.1",
"path-browserify": "^1.0.1",
"prop-types": "^15.6.0",
"proxyquire": "^1.7.11",
"raf": "^3.4.0",
Expand All @@ -178,18 +181,20 @@
"semantic-ui-react": "^1.2.1",
"sinon": "^4.0.1",
"standard-version": "^4.0.0",
"style-loader": "^0.19.0",
"stream-browserify": "^3.0.0",
"style-loader": "^3.3.3",
"styled-components": "^3.4.10",
"stylus": "^0.57.0",
"stylus-loader": "^3.0.2",
"stylus-loader": "^7.1.3",
"terser-webpack-plugin": "^5.3.9",
"tree-kill": "^1.2.2",
"ts-node": "^10.9.1",
"type-fest": "^3.13.1",
"typescript": "^5.0.4",
"url-loader": "^1.1.2",
"uglify-js": "^3.17.4",
"web-vitals": "^1.1.2",
"webpack": "^4.46.0",
"webpack-cli": "^4.10.0",
"webpack": "^5.89.0",
"webpack-cli": "^5.1.4",
"webpack-dev-server": "^3.11.3",
"webpack-merge": "^4.1.1"
}
Expand Down
34 changes: 5 additions & 29 deletions test/func/packages/basic/webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,35 +1,11 @@
const path = require('path');
const merge = require('webpack-merge');
const commonConfig = require('../webpack.common');

module.exports = {
module.exports = merge(commonConfig, {
entry: {
plugin: './lib/color-border.jsx'
},
module: {
rules: [
{
test: /\.css$/,
use: [
'style-loader',
'css-loader'
]
},
{
test: /\.jsx$/,
loader: 'babel-loader',
exclude: /node_modules/,
options: {
configFile: path.resolve(__dirname, '../../../../.babelrc')
}
}
]
},
output: {
filename: '[name].js',
path: __dirname,
library: '__hermione_html_reporter_register_plugin__',
libraryTarget: 'jsonp'
},
optimization: {
minimize: true
path: __dirname
}
};
});
34 changes: 5 additions & 29 deletions test/func/packages/menu-bar/webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,35 +1,11 @@
const path = require('path');
const merge = require('webpack-merge');
const commonConfig = require('../webpack.common');

module.exports = {
module.exports = merge(commonConfig, {
entry: {
plugin: './lib/menu-bar-item.jsx'
},
module: {
rules: [
{
test: /\.css$/,
use: [
'style-loader',
'css-loader'
]
},
{
test: /\.jsx$/,
loader: 'babel-loader',
exclude: /node_modules/,
options: {
configFile: path.resolve(__dirname, '../../../../.babelrc')
}
}
]
},
output: {
filename: '[name].js',
path: __dirname,
library: '__hermione_html_reporter_register_plugin__',
libraryTarget: 'jsonp'
},
optimization: {
minimize: true
path: __dirname
}
};
});
34 changes: 5 additions & 29 deletions test/func/packages/redux-with-server/webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,35 +1,11 @@
const path = require('path');
const merge = require('webpack-merge');
const commonConfig = require('../webpack.common');

module.exports = {
module.exports = merge(commonConfig, {
entry: {
plugin: './lib/color-border.jsx'
},
module: {
rules: [
{
test: /\.css$/,
use: [
'style-loader',
'css-loader'
]
},
{
test: /\.jsx$/,
loader: 'babel-loader',
exclude: /node_modules/,
options: {
configFile: path.resolve(__dirname, '../../../../.babelrc')
}
}
]
},
output: {
filename: '[name].js',
path: __dirname,
library: '__hermione_html_reporter_register_plugin__',
libraryTarget: 'jsonp'
},
optimization: {
minimize: true
path: __dirname
}
};
});
34 changes: 5 additions & 29 deletions test/func/packages/redux/webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,35 +1,11 @@
const path = require('path');
const merge = require('webpack-merge');
const commonConfig = require('../webpack.common');

module.exports = {
module.exports = merge(commonConfig, {
entry: {
plugin: './lib/color-border.jsx'
},
module: {
rules: [
{
test: /\.css$/,
use: [
'style-loader',
'css-loader'
]
},
{
test: /\.jsx$/,
loader: 'babel-loader',
exclude: /node_modules/,
options: {
configFile: path.resolve(__dirname, '../../../../.babelrc')
}
}
]
},
output: {
filename: '[name].js',
path: __dirname,
library: '__hermione_html_reporter_register_plugin__',
libraryTarget: 'jsonp'
},
optimization: {
minimize: true
path: __dirname
}
};
});
46 changes: 46 additions & 0 deletions test/func/packages/webpack.common.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
const path = require('path');
const TerserPlugin = require('terser-webpack-plugin');

module.exports = {
mode: 'production',
module: {
rules: [
{
test: /\.css$/,
use: [
'style-loader',
'css-loader'
]
},
{
test: /\.jsx$/,
loader: 'babel-loader',
exclude: /node_modules/,
options: {
configFile: path.resolve(__dirname, '../../../.babelrc')
}
}
]
},
output: {
filename: '[name].js',
library: '__hermione_html_reporter_register_plugin__',
libraryTarget: 'jsonp'
},
optimization: {
minimize: true,
minimizer: [
new TerserPlugin({
parallel: true,
minify: TerserPlugin.uglifyJsMinify,
terserOptions: {
annotations: false,
output: {
comments: false
}
},
extractComments: false
})
]
}
};
35 changes: 24 additions & 11 deletions webpack.common.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const CssMinimizerPlugin = require('css-minimizer-webpack-plugin');
const TerserPlugin = require('terser-webpack-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const HtmlWebpackIncludeAssetsPlugin = require('html-webpack-include-assets-plugin');
const HtmlWebpackTagsPlugin = require('html-webpack-tags-plugin');
const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin');
const {ProgressPlugin} = require('webpack');

Expand All @@ -18,7 +18,12 @@ module.exports = {
gui: ['./gui.jsx', './variables.css', './styles.css', './gui.css']
},
resolve: {
extensions: ['.js', '.jsx', '.ts', '.tsx']
extensions: ['.js', '.jsx', '.ts', '.tsx'],
fallback: {
crypto: require.resolve('crypto-browserify'),
path: require.resolve('path-browserify'),
stream: require.resolve('stream-browserify')
}
},
context: path.resolve(__dirname, 'lib', 'static'),
output: {
Expand Down Expand Up @@ -48,8 +53,17 @@ module.exports = {
},
{
test: /\.(png|woff|woff2|eot|ttf|svg)$/,
loader: 'url-loader'
type: 'asset',
parser: {
dataUrlCondition: {
maxSize: 4 * 1024 // 4kb
}
},
generator: {
filename: path.resolve(__dirname, 'lib', 'static', 'assets', '[contenthash][ext][query]')
}
}

]
},
plugins: [
Expand All @@ -76,9 +90,9 @@ module.exports = {
template: 'template.html',
chunks: ['report']
}),
new HtmlWebpackIncludeAssetsPlugin({
new HtmlWebpackTagsPlugin({
files: ['index.html'],
assets: ['data.js', 'sql-wasm.js'],
scripts: ['data.js', 'sql-wasm.js'],
append: false
}),
new HtmlWebpackPlugin({
Expand All @@ -87,9 +101,9 @@ module.exports = {
template: 'template.html',
chunks: ['gui']
}),
new HtmlWebpackIncludeAssetsPlugin({
new HtmlWebpackTagsPlugin({
files: ['gui.html'],
assets: ['sql-wasm.js'],
scripts: ['sql-wasm.js'],
append: false
})
],
Expand All @@ -100,11 +114,10 @@ module.exports = {
parallel: true,
minify: TerserPlugin.uglifyJsMinify,
terserOptions: {
compress: true,
mangle: true,
format: {
output: {
comments: false
}
},
annotations: false
},
extractComments: false
})
Expand Down
5 changes: 0 additions & 5 deletions webpack.dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,6 @@ module.exports = merge(
minimize: false
},
devtool: 'eval-source-map',
devServer: {
contentBase: './lib/static',
inline: true,
hot: true
},
plugins: [
new webpack.HotModuleReplacementPlugin()
]
Expand Down

0 comments on commit 5fd52d4

Please sign in to comment.