File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -199,22 +199,11 @@ function getNodeModuleData(module: Webpack.Module): NodeModule.Data | null {
199199 return null ;
200200 }
201201
202- function cleanWindowsPaths ( paths : RegExpMatchArray | null ) {
203- var out : string [ ] = [ ] ;
204- if ( ! paths ) {
205- return out ;
206- }
207- for ( var i = 0 ; i < paths . length ; i += 1 ) {
208- out [ i ] = paths [ i ] . replace ( ':' , '' ) . split ( '\\' ) . join ( '/' ) ;
209- }
210- return out ;
211- }
212-
213202 // Note that the negative lookahead (?!.*node_modules) ensures that we only match the last node_modules/ folder in the path,
214203 // in case the package was located in a sub-node_modules (which can occur in special circumstances).
215204 // We also need to take care of scoped modules. If the name starts with @ we must keep two parts,
216205 // so @corp /bar is the proper module name.
217- const modulePaths = cleanWindowsPaths ( module . resource . match ( / ( .* \b n o d e _ m o d u l e s [ \\ / ] (? ! .* \b n o d e _ m o d u l e s \b ) ( (?: @ [ ^ \\ / ] + [ \\ / ] ) ? [ ^ \\ / ] + ) ) ( .* ) / i) ) ;
206+ const modulePaths = module . resource . match ( / ( .* \b n o d e _ m o d u l e s [ \\ / ] (? ! .* \b n o d e _ m o d u l e s \b ) ( (?: @ [ ^ \\ / ] + [ \\ / ] ) ? [ ^ \\ / ] + ) ) ( .* ) / i) ;
218207 if ( ! modulePaths || modulePaths . length !== 4 ) {
219208 return null ;
220209 }
You can’t perform that action at this time.
0 commit comments