2.0.0 • Published 6 years ago

inject-webpack-plugin v2.0.0

Weekly downloads
23
License
MIT
Repository
github
Last release
6 years ago

webpack Dependency Injection Plugin

A simple webpack plugin for injecting dependencies.

Installation

Install the plugin with npm:

$ npm install inject-webpack-plugin --save-dev

Basic Usage

In your webpack.config.js

import InjectWebpackPlugin from 'webpack-inject-plugin';

export default {
    // ...
    plugins: [
      new InjectWebpackPlugin({
        'path/to/file': 'path/to/another/file',
        'path/to/file.scss': 'path/to/another/file.scss',
        'react': 'replacing/react/like/a/boss'
      });
    ]
};

This will replace any instances of path/to/file with path/to/another/file, path/to/file.scss with path/to/another/file.scss, as well as allowing you to replace react if you so wish.

Useful for getting around things like this by combining with environment variables. For example:

if (process.env.NODE_ENV === 'development') {
  plugins.push(
    new InjectWebpackPlugin({
      'configureStore': 'configureStore.dev'
    });
  )
}
2.0.0

6 years ago

1.0.1

7 years ago

1.0.0

7 years ago

0.4.0

7 years ago

0.3.0

8 years ago

0.2.1

8 years ago

0.2.0

8 years ago

0.1.0

8 years ago