Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

webpack-chunk-rename-plugin

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

webpack-chunk-rename-plugin

Plugin to rename webpack chunks

  • 1.0.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.9K
increased by8.85%
Maintainers
1
Weekly downloads
 
Created
Source

webpack-chunk-rename-plugin

This plugin helps with chunk naming in webpack. To use it you need at least webpack 4.1

Install

npm install webpack-chunk-rename-plugin --save-dev

or if you are using yarn

yarn add webpack-chunk-rename-plugin --dev

Usage

const ChunkRenamePlugin = require("webpack-chunk-rename-plugin");

module.exports = {
  ...
  plugins: [
    new ChunkRenamePlugin(objectWithOptions),
  ],
}
OptionTypeDescription
initialChunksWithEntry`booleanstring`
asyncChunksstringUse provided string to rename all async chunks. Just like for previous option, standart placeholders could be used.
[chunkName]stringUse provided string to rename specific chunk.

Examples

The result of the code below will be: use filename option for all chunks with entry and "specialName.[name].js" template for mySpecialChunk chunk (assuming you're not using it as a test option for splitChunks.cacheGroups).

module.exports = {
  output: {
    filename: "[name].js",
    chunkFilename: "[name].[chunkhash].js",
  },
  entry: {
    mySpecialChunk: "path/to/my/chunk",
    ....
  },
  ....
  plugins: [
    new ChunkRenamePlugin({
      initialChunksWithEntry: true,
      mySpecialChunk: "specialName.[name].js",
    }),
  ],
}

Motivation

Currently if you want to move webpack runtime into the separate file you will use optimization.runtimeChunk option, you all of the chunks, which do not have runtime in them will use output.chunkFilename for the filename, event if it contains entry. See issue.
There are a few plugins for chunk renaming, however i haven't found plugin that is compatible with webpack 4.

Keywords

FAQs

Package last updated on 22 Apr 2018

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc