inject config into webpack bundle
npm install inject-config-loader --save-dev
or
yarn add -D inject-config-loader
// webpack.config.js
module.exports = {
// ...
resolve: {
alias: {
config: path.join(__dirname, 'source/dummy.config')
}
},
module: {
rules: [
{
test: /\.config$/,
use: [
{
loader: 'inject-config-loader',
options: {
field: 'front'
}
}
]
}
]
},
// ...
}
Name of a config property that will be injected. By default whole config is injected.
Default value: true (recommended for production). If false, all changes in config files will trigger an incremental build.
See sample webpack.config.js in demo folder.