custom-webpack-named-plugin

0.0.2 • Public • Published

custom-webpack-named-plugin

This is a custom module plugin package for webpack. it allows you to command your module name in your own way.this is very useful for module reusability, especially in the production environment.

Mode of use

  npm i --save-dev custom-webpack-named-plugin
  yarn add --dev custom-webpack-named-plugin

hashedPlugin

if you use hashedModuleIds of webpack>=4 or HashedModuleIdsPlugin of webpack<4

  let CustomHashedPlugin = require("custom-webpack-named-plugin").hashedPlugin

the default type of mapping object is String webpack.config.js

  plugins: [
    new CustomHashedPlugin({
      mapping:{
        type: 'String',
        match: {
          './src/index.js':'customName'
        }
      }
    })
  ]
  

namedPlugin

if you use namedModules of webpack>=4 or Namedmodulesplugin of webpack<4

  let CustomNamedPlugin = require("custom-webpack-named-plugin").namedPlugin

webpack.config.js

  plugins: [
    new CustomNamedPlugin({
      mapping:{
        type: 'String',
        match: {
          './src/index.js':'customName'
        }
      }
    })
  ] 

it also allows you use RegExp type

webpack.config.js

  plugins: [
    new CustomNamedPlugin({
      mapping:{
        type: 'RegExp'
        './src/(\\w+).js':'$1'
      }
    })
  ]

Package Sidebar

Install

npm i custom-webpack-named-plugin

Weekly Downloads

0

Version

0.0.2

License

MIT

Unpacked Size

5.42 kB

Total Files

5

Last publish

Collaborators

  • emcty