1.0.0 • Published 7 years ago

webpack-environment-config-plugin v1.0.0

Weekly downloads
3
License
MIT
Repository
github
Last release
7 years ago

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

apply void

  • @params

    • compiler