dedupewebpackloader
v0.0.4
Published
Dedupe webpack loaders
Downloads
15
Readme
Merge webpack configuration
We firstly use webpack-merge to merge our webpack configuration. Then, we can use dedupeWebpackLoader
to unique this loader.
const loader1= {
module:{
rules:[{
test: /\.js(x)*/,
exclude: function(path){
var isNpmModule=!!path.match(/node_modules/);
return isNpmModule;
},
loader: require.resolve('babel-loader')
}]
}
}
//loader will override it!
const loader2 = {
module:{
rules:[
{
test: /\.js(x)*/,
exclude: function(path){
var isNpmModule=!!path.match(/node_modules/);
return isNpmModule;
},
loader: require.resolve('after')
}]
}
}
//const defaultWebpackConfig = merge(loader1,loader2);
Dedupe loader
Use DedupeWebpackLoader
, we will Get loader2 as final loader
const loader2 = {
module:{
rules:[
{
test: /\.js(x)*/,
exclude: function(path){
var isNpmModule=!!path.match(/node_modules/);
return isNpmModule;
},
loader: require.resolve('after')
}]
}
}