Wondering what’s next for npm?Check out our public roadmap! »

webpack-alias-config-plugin

0.0.2 • Public • Published

webpack-alias-config-plugin

Webpack plugin that provides a convenience to override modules require paths, with an external set of matching files.

Usage

// webpack.config.js
import WebpackAliasConfigPlugin from 'webpack-alias-config-plugin'
 
const webpackConfig = {
    plugins: [
        new WebpackAliasConfigPlugin({
            config: 'webpack.config.js',
            findConfig: true
        })
    ]
}
 

Installation

Install via npm:

npm install --save-dev webpack-alias-config-plugin

Api

new WebpackAliasConfigPlugin({ config, findConfig, extensions })
  • config(string): Path to your webpack config file.

    The plugin is going to look for a webpack.config.js file or a webpack.config.babel.js at the root, in case your webpack configuration file is in another location, you can use this option to provide an absolute or relative path to it. You can also use environment variable in this option, using lodash template, for example:

    const webpackConfig = {
        plugins: [
            new WebpackAliasConfigPlugin({
                config: "${PWD}/webpack.config.test.js",
            })
        ]
    }

    And run with:

    $ PWD=$(pwd) NODE_ENV=test ava
  • findConfig(boolean): Will find the nearest webpack configuration file when set to true.

    It is possible to pass a findConfig option, and the plugin will attempt to find the nearest webpack configuration file within the project using find-up. For example:

    const webpackConfig = {
        plugins: [
            new WebpackAliasConfigPlugin({
                config: "webpack.config.test.js",
                findConfig: true
            })
        ]
    }
  • extensions (optional) array of extensions to resolve against (default: ['jsx', 'js'])

Install

npm i webpack-alias-config-plugin

DownloadsWeekly Downloads

1

Version

0.0.2

License

MIT

Unpacked Size

14.3 kB

Total Files

4

Last publish

Collaborators

  • avatar