chore: update webpack

This commit is contained in:
Bill Church 2024-07-10 13:50:18 +00:00
parent 533f719cca
commit cd64cc0637
No known key found for this signature in database
2 changed files with 26 additions and 19 deletions

View file

@ -18,7 +18,9 @@ module.exports = {
}, },
plugins: [ plugins: [
new BannerPlugin({ new BannerPlugin({
banner: `Version ${packageJson.version} - ${new Date().toISOString()}`, banner: `Version ${
packageJson.version
} - ${new Date().toISOString()} - ${commitHash}`,
include: /\.(js|css|html|htm)$/, include: /\.(js|css|html|htm)$/,
}), }),
new CleanWebpackPlugin(["client/public"], { new CleanWebpackPlugin(["client/public"], {
@ -29,10 +31,11 @@ module.exports = {
template: "./client/src/client.htm", // Path to your source template template: "./client/src/client.htm", // Path to your source template
filename: "client.htm", // Optional: output file name, defaults to index.html filename: "client.htm", // Optional: output file name, defaults to index.html
minify: false, minify: false,
scriptLoading: "blocking", scriptLoading: "defer",
version: `Version ${ version: `Version ${
packageJson.version packageJson.version
} - ${new Date().toISOString()} - ${commitHash}`, } - ${new Date().toISOString()} - ${commitHash}`,
publicPath: "/ssh/", // Prepend /ssh/ to the script tags
}), }),
new CopyWebpackPlugin([ new CopyWebpackPlugin([
{ from: "./client/src/favicon.ico", to: "favicon.ico" }, { from: "./client/src/favicon.ico", to: "favicon.ico" },
@ -42,6 +45,7 @@ module.exports = {
output: { output: {
filename: "[name].bundle.js", filename: "[name].bundle.js",
path: path.resolve(__dirname, "../client/public"), path: path.resolve(__dirname, "../client/public"),
publicPath: "/ssh/", // Prepend /ssh/ to the script tags
}, },
module: { module: {
rules: [ rules: [

View file

@ -1,18 +1,21 @@
const merge = require('webpack-merge') const merge = require("webpack-merge");
const UglifyJSPlugin = require('uglifyjs-webpack-plugin') const UglifyJSPlugin = require("uglifyjs-webpack-plugin");
const common = require('./webpack.common.js') const common = require("./webpack.common.js");
module.exports = merge(common, { module.exports = merge(
plugins: [ {
new UglifyJSPlugin({ plugins: [
uglifyOptions: { new UglifyJSPlugin({
ie8: false, uglifyOptions: {
dead_code: true, ie8: false,
output: { dead_code: true,
comments: false, output: {
beautify: false comments: false,
} beautify: false,
} },
}) },
] }),
}) ],
},
common
);