Instead of forcing a recompile on an unknown value and on unknown module
imports, opt to only recompile for unknown module imports. An unknown
value may be a typo. Having a faster feedback loop in these cases seems
ideal.
})
.then(compileMessages => {
if (res.resultType === 'error') {
- if (res.result.some(item => item.errorCode === 'UnknownModule' || item.errorCode === 'UnknownName')) {
+ if (res.result.some(item => {
+ const isUnknownModule = item.errorCode === 'UnknownModule';
+
+ const isUnknownModuleImport = item.errorCode === 'UnknownName' && /Unknown module/.test(item.message);
+
+ return isUnknownModule || isUnknownModuleImport;
+ })) {
debug('unknown module, attempting full recompile')
return Psc.compile(psModule)
.then(() => PsModuleMap.makeMap(options.src).then(map => {