loaders , include exclude. RegEx .
JavaScript , ./secret.
var path = require('path');
module.exports = {
module :{
loaders : [
{
test: /\.js$/,
loader: "script",
exclude : path.resolve(__dirname, './secret')
},
{
test: /\.css$/,
loader: "style!css"
}
]
}
};
./secret , src, .
var path = require('path');
var blackList = [ path.resolve(__dirname, './secret') ];
var whiteList = [ /src/ ];
var config = {
...
};
config.module.loaders.forEach(function(loader)
{
loader['exclude'] = [...(loader['exclude'] || []), ...blackList];
loader['include'] = [...(loader['include'] || []), ...whiteList];
});
module.exports = config;
, , . , , / .
:
, , . , sqlconnections.js, sqlconnections.confidential.js. RegEx /\.confidential\.js$/ . , .