@@ -104,7 +104,7 @@ function getPackageAureliaResources(packageJson) {
104
104
105
105
function getPackageMainDir ( packagePath ) {
106
106
const packageJson = getPackageJson ( packagePath ) ;
107
- const packageMain = packageJson . main || packageJson . browser ;
107
+ const packageMain = packageJson . aurelia && packageJson . aurelia . main && packageJson . aurelia . main [ 'native-modules' ] || packageJson . main || packageJson . browser ;
108
108
return packageMain ? path . dirname ( path . join ( packagePath , packageMain ) ) : null ;
109
109
}
110
110
@@ -283,12 +283,26 @@ function getResourcesOfPackage(resources = {}, packagePath = undefined, relative
283
283
// recursively load resources of all 'dependencies' defined in package.json:
284
284
if ( packageJson . dependencies ) {
285
285
for ( let moduleName of Object . getOwnPropertyNames ( packageJson . dependencies ) ) {
286
- let modulePathIndex = moduleNames . indexOf ( moduleName ) ;
286
+ const modulePathIndex = moduleNames . indexOf ( moduleName ) ;
287
287
if ( modulePathIndex !== - 1 ) {
288
- let modulePath = modulePaths [ modulePathIndex ] ;
288
+ const modulePath = modulePaths [ modulePathIndex ] ;
289
289
getResourcesOfPackage ( resources , modulePath , undefined , undefined /* might add defaults from plugin config */ , moduleName ) ;
290
290
}
291
291
}
292
+
293
+ if ( ! externalModule ) {
294
+ // iterate again, now to add modules themselves if not yet added:
295
+ for ( let moduleName of Object . getOwnPropertyNames ( packageJson . dependencies ) ) {
296
+ const modulePathIndex = moduleNames . indexOf ( moduleName ) ;
297
+ if ( modulePathIndex !== - 1 ) {
298
+ const modulePath = modulePaths [ modulePathIndex ] ;
299
+ // add the module itself
300
+ if ( ! resources [ moduleName ] && getPackageMainDir ( modulePath ) ) {
301
+ resources [ moduleName ] = { path : moduleName , source : moduleName , moduleName, modulePath } ;
302
+ }
303
+ }
304
+ }
305
+ }
292
306
}
293
307
}
294
308
}
0 commit comments