webpack-environment-config-plugin
v1.0.0
Published
Lightweight and zero-dependecies plugin for webpack that allows you to create file on deploy by environment configuration.
Downloads
3
Maintainers
Readme
Webpack environment config plugin
Lightweight and zero-dependecies plugin for webpack that allows you to create file on deploy by environment configuration.
How to install?
Easy.
npm install webpack-environment-config-plugin --save-dev
Then, add to your(s) webpack config file like webpack.config.js
(or similar, by environment).
// ...requires
const EnvironmentConfigurationFiles = require('webpack-environment-config-plugin');
const filename = 'config.json';
const envConfig = JSON.stringify({
myConfig: 'value'
});
module.exports = function () {
return {
// ...
// your webpack config here
output: {
path: 'dist/', // REQUIRED
},
plugins: [
// ...
// other plugins
new EnvironmentConfigurationFiles(filename, envConfig)
]
}
};
API
constructor: void
- @params
- filename
- data (environment config)
- options object
- encoding [string|null] (default: UTF-8)
- mode [integer] *(default: 0o666)
apply void
- @params
- compiler