overwrite-webpack-plugin
v1.3.5
Published
A Webpack plugin that resolves a file with overwritten one
Downloads
333
Readme
Overwrite resolver plugin for Webpack V4
Why
Sometimes we need to override a whole module (file) for some reasons, say, customization, fixing node modules etc. But Webpack resolve.alias
seems not handle these complex cases. This plugin makes it possible to replace a file with another one in the specified folder or with specific label.
Usage
Add the following to Webpack's config file:
const OverwriteWebpackPlugin = require("overwrite-webpack-plugin");
resolve: {
plugins: [
new OverwriteWebpackPlugin({
extensions: ['.js', '.jsx'], // resolve specified extensions
label: 'mobile', // resolve as foo.mobile.js while import or require foo.js
dirs:['from', 'to'] // resolve a file in 'from' directory as responding one in 'to' directory
verbose: true // prompt the overwritten files
})
]
}