path-replace-plus-loader
v1.0.0
Published
path replace loader(plus) for webpack
Downloads
2
Readme
path-replace-plus-loader for webpack
Path replace loader(plus) for webpack. Replace a or some given base path with another path for dynamic module loading. Great for large applications with locally overridable modules.
Installation
npm install path-replace-plus-loader
Usage
Configuration
- list: An array of replace rules
The rules must be like:
- path: Absolute original path to replace, e.g. __dirname/app/core
- replacePath: Absolute replacement path, e.g. __dirname/app/local
webpack config example
module.exports = {
module: {
loaders: [
{
test: /\.js$/,
loader: 'path-replace-plus',
query: {
list: [{
path: 'ORIGINAL_PATH 1',
replacePath: 'REPLACE_PATH 1'
},{
path: 'ORIGINAL_PATH 2',
replacePath: 'REPLACE_PATH 2'
}]
}
}
]
}
};
Example
// Loader tries to load from local directory if file exists app/local/modules/auth
var authModule = require('app/core/modules/auth');