webpack-alias-config-plugin v0.0.2
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-pluginApi
new WebpackAliasConfigPlugin({ config, findConfig, extensions })config(string): Path to your webpack config file.The plugin is going to look for a
webpack.config.jsfile or awebpack.config.babel.jsat 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 avafindConfig(boolean): Will find the nearest webpack configuration file when set totrue.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)arrayof extensions to resolve against (default: 'jsx', 'js')