webpack-proxy-plugin
v1.0.5
Published
webpack proxy plugin
Downloads
2
Readme
# webpack-proxy-plugin
Introduction
The local proxy server for webpack and node.js, which can match the online files to the local. For better develop.
Installation
$ npm install webpack-proxy-plugin --save-dev
Usage
Just add the plugin to your webpack config as follows:
// webpack.config.js
const WebpackProxyPlugin = require('webpack-proxy-plugin');
const proxyRules = require('./proxy-rules');
const webpackConfig = {
entry: {
// code
},
output: {
// code
},
plugins: [
new WebpackProxyPlugin(proxyRules)
]
}
// proxy-rules.js
module.exports = {
'project_name': {
// The file after compile which can `console.log`. In most time,
// it equals the output path.
develop:`/dist/develop/`,
// The file after compile which has been compress and drop console.
// And the others are same with `develop` options.
production: `/dist/production/`,
// True will read the file where in develop path, instead
// will read file through production path.
debug: true
}
}
License
MIT