Webpack: add DeadCodePlugin to detect unused files

next-virtuoso
Alex Gleason 2 years ago
parent c2278aa679
commit 4adb42e426
No known key found for this signature in database
GPG Key ID: 7211D1F99744FBB7

@ -191,6 +191,7 @@
"webpack-assets-manifest": "^5.0.6",
"webpack-bundle-analyzer": "^4.4.2",
"webpack-cli": "^4.8.0",
"webpack-deadcode-plugin": "^0.1.16",
"webpack-merge": "^5.8.0",
"wicg-inert": "^3.1.1"
},

@ -9,6 +9,7 @@ const HtmlWebpackPlugin = require('html-webpack-plugin');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const webpack = require('webpack');
const AssetsManifestPlugin = require('webpack-assets-manifest');
const DeadCodePlugin = require('webpack-deadcode-plugin');
const { env, settings, output } = require('./configuration');
const rules = require('./rules');
@ -86,6 +87,19 @@ module.exports = {
writeToDisk: true,
publicPath: true,
}),
// https://github.com/MQuy/webpack-deadcode-plugin
new DeadCodePlugin({
patterns: [
'app/**/*',
],
exclude: [
'**/*.test.*',
'**/__*__/*',
'**/(LICENSE|README|COPYING)(.md|.txt)?',
// This file is imported with @preval
'app/soapbox/features/emoji/emoji_map.json',
],
}),
// https://github.com/jantimon/html-webpack-plugin#options
new HtmlWebpackPlugin(makeHtmlConfig()),
new HtmlWebpackPlugin(makeHtmlConfig({ filename: '404.html' })),

@ -10786,6 +10786,14 @@ webpack-cli@^4.8.0:
v8-compile-cache "^2.2.0"
webpack-merge "^5.7.3"
webpack-deadcode-plugin@^0.1.16:
version "0.1.16"
resolved "https://registry.yarnpkg.com/webpack-deadcode-plugin/-/webpack-deadcode-plugin-0.1.16.tgz#f58ec7bd908325247396438a50afc209bfd01bdd"
integrity sha512-T3oRlzftN4jU8Wm8rjx9mzYC8zr4CND5kNgh6EBJyhWy68F5kZ334EjdBjOKDEpUHuybBuxi/SviVUFsP0gx4g==
dependencies:
chalk "^3.0.0"
fast-glob "^3.1.1"
webpack-dev-middleware@^5.1.0:
version "5.1.0"
resolved "https://registry.yarnpkg.com/webpack-dev-middleware/-/webpack-dev-middleware-5.1.0.tgz#90a645b077e85f661c5bb967dc32adc3eceb5cfd"

Loading…
Cancel
Save