webpack-resolve-path-rewrite-plugin
v1.0.4
Published
A plugin for enhanced-resolve (Webpack v2) that rewrites specified string inside the path
Downloads
4
Maintainers
Readme
webpack-resolve-path-rewrite-plugin
A plugin for enhanced-resolve
(Webpack v2) that replaces specified string inside the path.
Installation
npm install --save-dev webpack-resolve-path-rewrite-plugin
Usage
var path = require('path');
var PathRewrite = require('webpack-resolve-path-rewrite-plugin');
module.exports = {
// ...
resolve: {
plugins: [
new PathRewritePlugin({pathMap: {
'/module/': '/../../CommonEngine/src/module/'
}})
]
},
// ...
};
Example:
webpack.config.js
new PathRewritePlugin({pathMap: {
'/module/': '/../../CommonEngine/src/module/'
}})
actions/sendForm.js
import 'src/module/index' // Changes to 'src/../../CommonEngine/src/module/index'
Why
Why rewrite paths?
When:
- Multiple entrypoints require a common module inside their directory (i.e. submodule)
- You want to use CommonsChunkPlugin
Change log
1.0.1
Solved bugs.
1.0.0
Initial release.