@@ -133,11 +133,14 @@ exports.run = function (options) {
133
133
if ( ! isCompilingAll ) {
134
134
( function ( ) {
135
135
// 去掉版本号和打头的"/"
136
- var urlNoVer = req . url . replace ( / @ [ \d \w ] + (? = \. \w + $ ) / , '' ) ;
137
- urlNoVer = urlNoVer [ 0 ] === '/' ? urlNoVer . slice ( 1 ) : urlNoVer ;
136
+ var pureSourcePath = req . url . replace ( / @ [ \d \w ] + (? = \. \w + $ ) / , '' ) ;
137
+ pureSourcePath = pureSourcePath [ 0 ] === '/' ? pureSourcePath . slice ( 1 ) : pureSourcePath ;
138
+
139
+ // 去掉url query
140
+ pureSourcePath = pureSourcePath . replace ( / \? [ \w = & ] + $ / , '' ) ;
138
141
139
142
// 从编译cache中取,map文件不必生成重复middleware
140
- var cacheId = sysPath . join ( projectName , urlNoVer . replace ( '.map' , '' ) ) ;
143
+ var cacheId = sysPath . join ( projectName , pureSourcePath . replace ( '.map' , '' ) ) ;
141
144
var middleware = middlewareCache [ cacheId ] ;
142
145
143
146
if ( ! middleware ) {
@@ -160,7 +163,7 @@ exports.run = function (options) {
160
163
161
164
var cssReg = new RegExp ( config . entryExtNames . css . join ( '|' ) ) ;
162
165
entryPath = entryPath . replace ( cssReg , '.css' ) ; // 将入口的.scss/.less后缀替换为.css
163
- isRequestingEntry = entryPath . indexOf ( urlNoVer ) > - 1 ;
166
+ isRequestingEntry = entryPath . indexOf ( pureSourcePath ) > - 1 ;
164
167
165
168
if ( isRequestingEntry ) {
166
169
nextConfig . entry = _defineProperty ( { } , entryKey , entryItem ) ;
@@ -171,7 +174,7 @@ exports.run = function (options) {
171
174
172
175
compiler . watch ( { } , function ( err , stats ) {
173
176
// compiler complete
174
- middleware = middlewareCache [ cacheId ] = webpackDevMiddleware ( compiler , { quiet : true } ) ;
177
+ middleware = middlewareCache [ cacheId ] = webpackDevMiddleware ( compiler , { quiet : true , clientLogLevel : 'error' } ) ;
175
178
middleware ( req , res , next ) ;
176
179
} ) ;
177
180
// 检测config文件变化
0 commit comments