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.
npm install path-replace-plus-loader
- 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
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'
}]
}
}
]
}
};
// Loader tries to load from local directory if file exists app/local/modules/auth
var authModule = require('app/core/modules/auth');