@@ -203,27 +203,27 @@ exports.run = function (options) {
203
203
return ;
204
204
}
205
205
206
- // 修改 publicPath 为当前服务
207
- if ( project . config . replacingPublicPath !== false ) {
208
- var localPublicPath = wpConfig . output . local . publicPath ;
209
- var hostReg = / ( h t t p : | h t t p s : ) ? ( \/ \/ ) ( [ ^ \/ ] + ) / i;
210
- if ( localPublicPath && localPublicPath . match ( hostReg ) . length === 4 ) {
211
- localPublicPath = '/' + UtilPath . normalize ( localPublicPath , false ) ;
212
- localPublicPath = localPublicPath . replace ( hostReg , function ( matches , httpStr , splitStr , host ) {
213
- httpStr = httpStr || '' ;
214
- return httpStr + '//' + '127.0.0.1:' + port ;
215
- } ) ;
206
+ // hot reload
207
+ if ( hot ) {
208
+ // 修改 publicPath 为当前服务
209
+ if ( project . config . replacingPublicPath !== false ) {
210
+ var localPublicPath = wpConfig . output . local . publicPath ;
211
+ var hostReg = / ( h t t p : | h t t p s : ) ? ( \/ \/ ) ( [ ^ \/ ] + ) / i;
212
+ if ( localPublicPath && localPublicPath . match ( hostReg ) . length === 4 ) {
213
+ localPublicPath = '/' + UtilPath . normalize ( localPublicPath , false ) ;
214
+ localPublicPath = localPublicPath . replace ( hostReg , function ( matches , httpStr , splitStr , host ) {
215
+ httpStr = httpStr || '' ;
216
+ return httpStr + '//' + '127.0.0.1:' + port ;
217
+ } ) ;
216
218
217
- wpConfig . output . local . publicPath = localPublicPath ;
218
- } else {
219
- // hot 且 未指定 publicPath 需要手动设置方式 hot.json 404
220
- var relativePath = sysPath . relative ( projectCwd , wpConfig . output . local . path ) ;
221
- wpConfig . output . local . publicPath = '/' + projectName + '/' + relativePath + '/' ;
219
+ wpConfig . output . local . publicPath = localPublicPath ;
220
+ } else {
221
+ // hot 且 未指定 publicPath 需要手动设置方式 hot.json 404
222
+ var relativePath = sysPath . relative ( projectCwd , wpConfig . output . local . path ) ;
223
+ wpConfig . output . local . publicPath = '/' + projectName + '/' + relativePath + '/' ;
224
+ }
222
225
}
223
- }
224
226
225
- // hot reload
226
- if ( hot ) {
227
227
wpConfig . plugins . push ( new webpack . HotModuleReplacementPlugin ( ) ) ;
228
228
229
229
if ( ! usingHotServer ) {
0 commit comments