even more
This commit is contained in:
parent
82e092ba55
commit
8f50ebdb97
1 changed files with 1842 additions and 3095 deletions
|
|
@ -22,8 +22,6 @@ module.exports = (env, argv) => {
|
|||
host: '0.0.0.0',
|
||||
allowedHosts: 'all',
|
||||
},
|
||||
// webpack-dev-server 5 no longer accepts `watchOptions` under `devServer`;
|
||||
// polling is configured on the compiler instead (needed for some FS mounts).
|
||||
watchOptions: {
|
||||
poll: true,
|
||||
},
|
||||
|
|
@ -33,23 +31,16 @@ module.exports = (env, argv) => {
|
|||
new HtmlWebpackPlugin({
|
||||
template: './src/index.html',
|
||||
}),
|
||||
// The SVG UI icons used to be inlined into the HTML by the (abandoned,
|
||||
// webpack-4-only) html-webpack-inline-svg-plugin. They are now emitted as
|
||||
// static files and referenced via `static/<name>.svg` from index.html.
|
||||
new CopyWebpackPlugin({
|
||||
patterns: [{ from: 'static/*.svg', to: 'static/[name][ext]' }],
|
||||
}),
|
||||
// Inline the extracted CSS into the HTML for production builds (replaces
|
||||
// the abandoned html-webpack-inline-source-plugin). In development the CSS
|
||||
// stays a separate, linked file for faster rebuilds.
|
||||
...(isProduction ? [new HTMLInlineCSSWebpackPlugin()] : []),
|
||||
],
|
||||
optimization: {
|
||||
minimizer: [
|
||||
new TerserJSPlugin({
|
||||
exclude: /node_modules/,
|
||||
// The custom serialization protocol keys on class names, so they must
|
||||
// survive minification (see shared/src/serialization).
|
||||
// The serialization protocol keys on class names.
|
||||
terserOptions: {
|
||||
keep_classnames: true,
|
||||
},
|
||||
|
|
@ -84,23 +75,12 @@ module.exports = (env, argv) => {
|
|||
],
|
||||
},
|
||||
{
|
||||
// SVGs referenced from CSS (`mask-image`/`background-image`) and JS
|
||||
// must be inlined as real `data:` URIs. svg-url-loader emits a CJS
|
||||
// module (`module.exports = "data:..."`) which webpack 5 + css-loader 7
|
||||
// write out verbatim as a `.svg` asset file, so the browser fetches JS
|
||||
// instead of an image and the mask/background silently fails. webpack 5's
|
||||
// built-in `asset/inline` produces a proper data URI instead.
|
||||
// (HTML <img> icons are unaffected: they are copied by CopyWebpackPlugin
|
||||
// and referenced by literal `static/*.svg` paths, not through this rule.)
|
||||
// svg-url-loader emits a CJS module that css-loader 7 writes out verbatim.
|
||||
test: /\.svg$/,
|
||||
type: 'asset/inline',
|
||||
},
|
||||
{
|
||||
// Use oneOf so each asset matches exactly one rule (og-image.png would
|
||||
// otherwise match both the generic png rule and its own rule).
|
||||
// The directory is encoded in `name` (not `outputPath`) and has no
|
||||
// leading slash: with the default `publicPath: 'auto'` a leading slash
|
||||
// produces a doubled slash in the emitted URL (e.g. `//static/x.mp3`).
|
||||
// No leading slash in `name`: with publicPath 'auto' it doubles the slash.
|
||||
oneOf: [
|
||||
{
|
||||
test: /og-image\.png$/,
|
||||
|
|
|
|||
Loading…
Reference in a new issue