Skip to content

Commit 7d0d181

Browse files
committed
webpack dev serverer proxy update
1 parent 04bbcf6 commit 7d0d181

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

webpack.config.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ const ENV = scriptName.indexOf('dev') === 0 ? 'development' : 'production';
1818
const isTest = scriptName.indexOf('test') >= 0 ? true : false;
1919
console.log('***** webpack runs in ' + ENV + (isTest ? ' (test)' : '') + ' environment\n');
2020

21+
const devServerPort = 5005;
22+
const devServerHost = 'localhost';
2123
let configEnv;
2224

2325
if (ENV === 'development') {
@@ -55,9 +57,9 @@ if (ENV === 'development') {
5557
]
5658
},
5759
proxy: {
58-
"/dist": {
59-
target: "http://localhost:5005",
60-
pathRewrite: {"^/dist" : ""}
60+
'/dist': {
61+
target: 'http://' + devServerHost + ':' + devServerPort,
62+
pathRewrite: {'^/dist' : ''}
6163
}
6264
},
6365
inline: true,
@@ -67,7 +69,8 @@ if (ENV === 'development') {
6769
errors: true,
6870
warnings: true
6971
},
70-
port: 5005,
72+
port: devServerPort,
73+
host: devServerHost,
7174
publicPath: '/'
7275
} : {},
7376

0 commit comments

Comments
 (0)