Skip to content

Commit fa46f99

Browse files
author
sky
committed
fix: port proxy not effective
1 parent 7d2302e commit fa46f99

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

app.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,16 @@ module.exports = app => {
2323
app.messenger.on(Constant.EVENT_WEBPACK_BUILD_STATE, data => {
2424
app.WEBPACK_BUILD_READY = data.state;
2525
const config = app.config.webpack;
26-
const port = data.port;
26+
const port = data.port || config.port;
2727
if (!app.WEBPACK_BUILD_PROXY && config.proxy) {
2828
app.WEBPACK_BUILD_PROXY = true;
2929
if (typeof config.proxy === 'boolean') {
3030
config.proxy = {
3131
host: `http://127.0.0.1:${port}`,
3232
match: /^\/public\//,
3333
};
34-
} else if (config.proxy.host) {
35-
config.proxy.host = config.proxy.host.replace(config.port, port);
34+
} else if (config.proxy.force !== true) {
35+
config.proxy.host = `http://127.0.0.1:${port}`;
3636
}
3737
app.middleware.splice(app.middleware.length - 2, 0, convert(proxy(config.proxy)));
3838
}
@@ -51,4 +51,4 @@ module.exports = app => {
5151
app.ready(() => {
5252
app.messenger.sendToAgent(Constant.EVENT_WEBPACK_BUILD_STATE);
5353
});
54-
};
54+
};

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "egg-webpack",
3-
"version": "4.5.0",
3+
"version": "4.5.1",
44
"description": "webpack dev server plugin for egg, support read file in memory and hot reload.",
55
"eggPlugin": {
66
"name": "webpack",

0 commit comments

Comments
 (0)