1 2 3 4 5 6 7 8 9 10 | module.exports = { .... devServer: { historyApiFallback: true, hot: true, inline: true, progress: true, }, ... } |
1 2 3 | "scripts": { "start": "webpack-dev-server --hot --inline --host 0.0.0.0 --port <port>" }, |
1 | $ npm start |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | proxy: { '/api': { target: 'https://other-server.example.com', secure: false } } // In webpack.config.js { devServer: { proxy: { '/api': { target: 'https://other-server.example.com', secure: false } } } } // Multiple entry proxy: [ { context: [ '/api-v1/**', '/api-v2/**' ], target: 'https://other-server.example.com', secure: false } ] |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | proxy: { '/some/path': { target: 'https://other-server.example.com', secure: false, bypass: function(req, res, proxyOptions) { if (req.headers.accept.indexOf('html') !== -1) { console.log('Skipping proxy for browser request.'); return '/index.html'; } } } |
欢迎光临 电子技术论坛_中国专业的电子工程师学习交流社区-中电网技术论坛 (http://bbs.eccn.com/) | Powered by Discuz! 7.0.0 |