1.0.7 • Published 10 years ago
webpack-modificators v1.0.7
webpack-modificators
This WebPack plugin allows to replace modules by modificator name.
Install
npm install webpack-modificators --save-devUsage
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_exampleRun jshint and tests:
npm testRun tests in Docker (node 0.10):
docker-compose run --rm test