webpack-environment-config-plugin

1.0.0 • Public • Published

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

Package Sidebar

Install

npm i webpack-environment-config-plugin

Weekly Downloads

3

Version

1.0.0

License

MIT

Last publish

Collaborators

  • fbadiola