@@ -218,15 +218,23 @@ var moduleRootOverride = {};
218
218
var modulePaths = [ ] ;
219
219
var moduleNames = [ ] ;
220
220
221
+ function installedRootModulePaths ( ) {
222
+ return fileSystem . readdirSync ( path . join ( optionsGlobal . root , 'node_modules' ) ) . filter ( function ( dir ) {
223
+ return ! / ^ \. / . test ( dir ) ;
224
+ } ) . map ( function ( dir ) {
225
+ return path . resolve ( optionsGlobal . root , 'node_modules' , dir ) ;
226
+ } ) ;
227
+ }
228
+
221
229
function installedLocalModulePaths ( ) {
222
230
return execa ( 'npm' , [ 'ls' , '--parseable' ] , { cwd : optionsGlobal . root } ) . then ( function ( res ) {
223
- return res . stdout . split ( '\n' ) . filter ( function ( line , i ) {
231
+ return installedRootModulePaths ( ) . concat ( res . stdout . split ( '\n' ) . filter ( function ( line , i ) {
224
232
return i !== 0 && ! ! line ;
225
- } ) ;
233
+ } ) ) ;
226
234
} ) . catch ( function ( res ) {
227
- return res . stdout . split ( '\n' ) . filter ( function ( line , i ) {
235
+ return installedRootModulePaths ( ) . concat ( res . stdout . split ( '\n' ) . filter ( function ( line , i ) {
228
236
return i !== 0 && ! ! line ;
229
- } ) ;
237
+ } ) ) ;
230
238
} ) ;
231
239
}
232
240
@@ -417,8 +425,8 @@ function processFromPath(resources, fromPath, resource, packagePath, relativeToD
417
425
resources [ fromPathCss ] = ( 0 , _assign2 . default ) ( { } , resource , realPath , overrideBlock || { } ) ;
418
426
}
419
427
} else {
420
- console . error ( 'Unable to resolve' , fromPath ) ;
421
- }
428
+ console . error ( 'Unable to resolve' , fromPath ) ;
429
+ }
422
430
}
423
431
424
432
function getResourcesOfPackage ( ) {
@@ -539,11 +547,11 @@ function fixRelativeFromPath(fromPath, realSrcPath, realParentPath, externalModu
539
547
if ( modulePathIndex !== - 1 ) {
540
548
return fromPath ;
541
549
} else {
542
- if ( fromPath . indexOf ( '.' ) == 0 ) {
543
- fromPath = path . joinSafe ( './' , path . relative ( realSrcPath , realParentPath ) , fromPath ) ;
544
- }
545
- return externalModule ? path . join ( externalModule , fromPath ) : fromPath ;
550
+ if ( fromPath . indexOf ( '.' ) == 0 ) {
551
+ fromPath = path . joinSafe ( './' , path . relative ( realSrcPath , realParentPath ) , fromPath ) ;
546
552
}
553
+ return externalModule ? path . join ( externalModule , fromPath ) : fromPath ;
554
+ }
547
555
}
548
556
549
557
function resolveTemplateResources ( htmlFilePath , srcPath , externalModule ) {
0 commit comments