webpack-modificators

1.0.7 • Public • Published

webpack-modificators

Build Status

NPM

This WebPack plugin allows to replace modules by modificator name.

Install

npm install webpack-modificators --save-dev

Usage

Add this plugin into your webpack config:

var WebpackModificators = require('webpack-modificators');
 
module.exports = {
  entry: { },
  output: { },
  plugins: [new WebpackModificators({strong: ['new']})]
};

WebpackModificators gets one argument: modificator name.

Webpack will try require dependency with name {dependency-name}--{modification-name} instead of {dependency-name}. If it's not possible webpack will use {dependency-name}.

Common case of this plugin: build the same entry point but with slightly different dependencies. To do it you may use list of webpack configs:

var WebpackModificators = require('webpack-modificators');
 
module.exports = [{
  entry: { entry1: 'file.js' },
  output: { }
}, {
  entry: { entry2: 'file.js' },
  output: { },
  plugins: [new WebpackModificators({strong: ['new']})]
}];

Development

Build an example:

npm run build_example

Run jshint and tests:

npm test

Run tests in Docker (node 0.10):

docker-compose run --rm test

Package Sidebar

Install

npm i webpack-modificators

Weekly Downloads

3

Version

1.0.7

License

MIT

Last publish

Collaborators

  • erm0l0v
  • opterion