Security News
NVD Backlog Tops 20,000 CVEs Awaiting Analysis as NIST Prepares System Updates
NVD’s backlog surpasses 20,000 CVEs as analysis slows and NIST announces new system updates to address ongoing delays.
chunk-rename-webpack-plugin
Advanced tools
Webpack plugin to name chunk files independently of output.filename & output.chunkFilename
This plugin allows you to rename specific chunks in your bundle independently from the configuration you set in output.filename
and output.chunkFilename
. Tested with webpack 1 and 2!
In general: Your output file names do not follow a consistent pattern.
loader.js
, that needs a static name, but all other files should be hashed)[name]
) and some files to use the module id ([id]
)This plugin is tested with the following module/runtime versions:
const path = require("path");
const ChunkRenamePlugin = require("chunk-rename-webpack-plugin");
module.exports = {
entry: {
loader: "./src/loader.js",
vendor: "./src/vendor.js"
},
output: {
path: path.resolve(__dirname, "..", "tmp"),
filename: "[name]-[chunkhash].js",
chunkFilename: "chunk-[name]-[chunkhash].js"
},
plugins: [
new ChunkRenamePlugin({
loader: "loader.js",
login: "chunk-[name]-page.js"
})
]
};
Result:
Hash: 8f17bb6534edbcdd963e
Version: webpack 1.15.0
Time: 73ms
Asset Size Chunks Chunk Names
loader.js 4.2 kB 0 [emitted] loader
login-page.js 117 bytes 1 [emitted] login
summary-8079db00b7b1bd6a78e6.js 113 bytes 2 [emitted] summary
vendor-ae2570120d44d2ba301c.js 1.43 kB 3 [emitted] vendor
[0] ./src/loader.js 440 bytes {0} [built]
[0] ./src/vendor.js 39 bytes {3} [built]
[1] ./src/loginPage.js 30 bytes {1} [built]
[2] ./src/summaryPage.js 32 bytes {2} [built]
The only argument for the plugin is an object that maps chunk names (as displayed in the webpack output) to filename templates. You can use all placeholders available for output.filename
in case you want to rename an entry chunk. If you want to rename a non-entry chunk you can use all variables available in output.chunkFilename
.
To be able to run the tests via npm test
you have to call npm run preparetest
beforehand. This installs webpack 1 and 2 into seperate folders (that's why they are not listed as devDependencies in the main package.json).
This plugin is heavily inspired by the core CommonsChunkPlugin
. Thanks to all webpack contributors for that!
FAQs
Webpack plugin to name chunk files independently of output.filename & output.chunkFilename
The npm package chunk-rename-webpack-plugin receives a total of 310 weekly downloads. As such, chunk-rename-webpack-plugin popularity was classified as not popular.
We found that chunk-rename-webpack-plugin demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
NVD’s backlog surpasses 20,000 CVEs as analysis slows and NIST announces new system updates to address ongoing delays.
Security News
Research
A malicious npm package disguised as a WhatsApp client is exploiting authentication flows with a remote kill switch to exfiltrate data and destroy files.
Security News
PyPI now supports digital attestations, enhancing security and trust by allowing package maintainers to verify the authenticity of Python packages.