return Promise.resolve(result);
}
else {
- debug('rebuilding module map due to additional imports for %s: %o', name, additionalImports);
-
- psModule.cache.psModuleMap = null;
+ const missingImports = additionalImports.filter(moduleName =>
+ !psModuleMap[moduleName] && moduleName.split('.')[0] !== 'Prim'
+ );
- return updatePsModuleMap(psModule).then(updatedPsModuleMap => {
- const additionalImportsResult = additionalImports.map(import_ => {
+ let updatingPsModuleMap;
+ if (missingImports.length > 0) {
+ debug('rebuilding module map due to missing imports for %s: %o', name, missingImports);
+ psModule.cache.psModuleMap = null;
+ updatingPsModuleMap = updatePsModuleMap(psModule);
+ } else {
+ updatingPsModuleMap = Promise.resolve(psModuleMap);
+ }
+
+ return updatingPsModuleMap.then(updatedPsModuleMap => {
+ const missingImportsResult = missingImports.map(import_ => {
const moduleValue = updatedPsModuleMap[import_];
if (!moduleValue) {
}
}).filter(a => a !== null).join('\n');
- return result + '\n' + additionalImportsResult;
+ return result + '\n' + missingImportsResult;
});
}
}