Replace copy/watching of non-language assets with copy-webpack-plugin

This commit is contained in:
Johannes Marbach 2023-11-16 14:21:45 +01:00
parent fd2f7884c8
commit d2fa827fad
6 changed files with 68 additions and 409 deletions

View file

@ -10,6 +10,7 @@ const OptimizeCSSAssetsPlugin = require("optimize-css-assets-webpack-plugin");
const HtmlWebpackInjectPreload = require("@principalstudio/html-webpack-inject-preload");
const { sentryWebpackPlugin } = require("@sentry/webpack-plugin");
const crypto = require("crypto");
const CopyWebpackPlugin = require("copy-webpack-plugin");
// XXX: mangle Crypto::createHash to replace md4 with sha256, output.hashFunction is insufficient as multiple bits
// of webpack hardcode md4. The proper fix it to upgrade to webpack 5.
@ -709,6 +710,23 @@ module.exports = (env, argv) => {
},
}),
new webpack.EnvironmentPlugin(["VERSION"]),
new CopyWebpackPlugin({
patterns: [
"res/apple-app-site-association",
"res/manifest.json",
"res/sw.js",
"res/welcome.html",
{ from: "welcome/**", context: path.resolve(__dirname, "res") },
{ from: "themes/**", context: path.resolve(__dirname, "res") },
{ from: "vector-icons/**", context: path.resolve(__dirname, "res") },
{ from: "decoder-ring/**", context: path.resolve(__dirname, "res") },
{ from: "media/**", context: path.resolve(__dirname, "node_modules/matrix-react-sdk/res/") },
"node_modules/@matrix-org/olm/olm_legacy.js",
"config.json",
"contribute.json",
],
}),
].filter(Boolean),
output: {