Add UnusedFilesWebpackPlugin to detect unused files

This commit is contained in:
Alex Gleason 2021-03-23 15:22:10 -05:00
parent a70c6c91af
commit 85939e9ec6
No known key found for this signature in database
GPG key ID: 7211D1F99744FBB7
4 changed files with 36 additions and 0 deletions

View file

@ -129,6 +129,7 @@
"ts-jest": "^26.4.1",
"typescript": "^4.0.3",
"uglifyjs-webpack-plugin": "^2.2.0",
"unused-files-webpack-plugin": "^3.4.0",
"uuid": "^8.0.0",
"webpack": "^4.41.2",
"webpack-assets-manifest": "^3.1.1",

View file

@ -6,6 +6,7 @@ const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const AssetsManifestPlugin = require('webpack-assets-manifest');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const HtmlWebpackHarddiskPlugin = require('html-webpack-harddisk-plugin');
const { UnusedFilesWebpackPlugin } = require('unused-files-webpack-plugin');
const { env, settings, output } = require('./configuration');
const rules = require('./rules');
@ -66,6 +67,13 @@ module.exports = {
writeToDisk: true,
publicPath: true,
}),
// https://www.npmjs.com/package/unused-files-webpack-plugin#options
new UnusedFilesWebpackPlugin({
patterns: ['app/**/*.*'],
globOptions: {
ignore: ['node_modules/**/*', '**/__*__/**/*'],
},
}),
// https://github.com/ampedandwired/html-webpack-plugin
new HtmlWebpackPlugin({
template: 'app/index.ejs',

View file

@ -2778,6 +2778,14 @@ babel-runtime@^6.26.0:
core-js "^2.4.0"
regenerator-runtime "^0.11.0"
babel-runtime@^7.0.0-beta.3:
version "7.0.0-beta.3"
resolved "https://registry.yarnpkg.com/babel-runtime/-/babel-runtime-7.0.0-beta.3.tgz#7c750de5514452c27612172506b49085a4a630f2"
integrity sha512-jlzZ8RACjt0QGxq+wqsw5bCQE9RcUyWpw987mDY3GYxTpOQT2xoyNoG++oVCHzr/nACLBIprfVBNvv/If1ZYcg==
dependencies:
core-js "^2.4.0"
regenerator-runtime "^0.11.0"
backoff@^2.4.1:
version "2.5.0"
resolved "https://registry.yarnpkg.com/backoff/-/backoff-2.5.0.tgz#f616eda9d3e4b66b8ca7fca79f695722c5f8e26f"
@ -5570,6 +5578,14 @@ getpass@^0.1.1:
dependencies:
assert-plus "^1.0.0"
glob-all@^3.1.0:
version "3.2.1"
resolved "https://registry.yarnpkg.com/glob-all/-/glob-all-3.2.1.tgz#082ca81afd2247cbd3ed2149bb2630f4dc877d95"
integrity sha512-x877rVkzB3ipid577QOp+eQCR6M5ZyiwrtaYgrX/z3EThaSPFtLDwBXFHc3sH1cG0R0vFYI5SRYeWMMSEyXkUw==
dependencies:
glob "^7.1.2"
yargs "^15.3.1"
glob-parent@^3.1.0:
version "3.1.0"
resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-3.1.0.tgz#9e6af6299d8d3bd2bd40430832bd113df906c5ae"
@ -12211,6 +12227,17 @@ unset-value@^1.0.0:
has-value "^0.3.1"
isobject "^3.0.0"
unused-files-webpack-plugin@^3.4.0:
version "3.4.0"
resolved "https://registry.yarnpkg.com/unused-files-webpack-plugin/-/unused-files-webpack-plugin-3.4.0.tgz#adc67a3b5549d028818d3119cbf2b5c88aea8670"
integrity sha512-cmukKOBdIqaM1pqThY0+jp+mYgCVyzrD8uRbKEucQwIGZcLIRn+gSRiQ7uLjcDd3Zba9NUxVGyYa7lWM4UCGeg==
dependencies:
babel-runtime "^7.0.0-beta.3"
glob-all "^3.1.0"
semver "^5.5.0"
util.promisify "^1.0.0"
warning "^3.0.0"
upath@^1.1.1:
version "1.1.2"
resolved "https://registry.yarnpkg.com/upath/-/upath-1.1.2.tgz#3db658600edaeeccbe6db5e684d67ee8c2acd068"