@scil/replace-chunks-name-webpack-plugin
v3.0.2
Published
perform str replacing on webpack chunks file name, useful to shorten filename
Downloads
2
Maintainers
Readme
perform replacing on webpack chunks filenames, useful to shorten filename when dev.
origin: webpack-replace-chunks-name-plugin which only replace the whole filename, not part. And it use api compilation.hooks.shouldGenerateChunkAssets
.
安装
pnpm add @scil/replace-chunks-name-webpack-plugin -D
yarn add @scil/replace-chunks-name-webpack-plugin -D
npm install @scil/replace-chunks-name-webpack-plugin -D
options
new ReplaceChunksNamePlugin({
enable: !isProdMode,
replaces: [
{
pattern: 'vendors-node_modules',
replacement: '[m',
},
{
pattern: /node_modules([-_])/g,
replacement: '[m-$1',
},
]
}
input:
chunk-vendors-node_modules_tinymce_tinymce-vue_lib_es2015_main_ts_index_js-node_modules_tinymce_ico-0fac6b.js
outputchunk-[m_tinymce_tinymce-vue_lib_es2015_main_ts_index_js-[m-_tinymce_ico-0fac6b.js
credit
- html-replace-webpack-plugin
chunk-name-shortener/lib/WebpackPluginChunkNameShortener.js use api
compilation.hooks.afterHash
which is used by this plugin.