From 3d8d32f41073a421b86fbb0ff7cb6f83b71f31f6 Mon Sep 17 00:00:00 2001 From: fatme Date: Thu, 22 Feb 2018 15:17:42 +0200 Subject: [PATCH] Use moduleResolution classic when --syncAllFiles option is not specified Fixes https://github.com/NativeScript/nativescript-cli/issues/3378 --- bin/ns-upgrade-tsconfig | 0 lib/before-prepare.js | 3 ++- lib/compiler.js | 4 ++++ lib/watch.js | 4 +++- 4 files changed, 9 insertions(+), 2 deletions(-) mode change 100644 => 100755 bin/ns-upgrade-tsconfig diff --git a/bin/ns-upgrade-tsconfig b/bin/ns-upgrade-tsconfig old mode 100644 new mode 100755 diff --git a/lib/before-prepare.js b/lib/before-prepare.js index ee41c5f..b563b79 100644 --- a/lib/before-prepare.js +++ b/lib/before-prepare.js @@ -11,5 +11,6 @@ module.exports = function ($logger, $projectData, $options, hookArgs) { } var release = $options.release || appFilesUpdaterOptions.release; - return compiler.runTypeScriptCompiler($logger, $projectData.projectDir, { release }); + var watchAllFiles = ($options && $options.syncAllFiles) || appFilesUpdaterOptions.watchAllFiles; + return compiler.runTypeScriptCompiler($logger, $projectData.projectDir, { release, watchAllFiles }); } diff --git a/lib/compiler.js b/lib/compiler.js index f5025ed..5959d39 100644 --- a/lib/compiler.js +++ b/lib/compiler.js @@ -35,6 +35,10 @@ function runTypeScriptCompiler(logger, projectDir, options) { nodeArgs.push('--inlineSourceMap', '--inlineSources'); } + if (!options.watchAllFiles) { + nodeArgs.push('--moduleResolution', 'classic'); + } + logger.trace(process.execPath, nodeArgs.join(' ')); tsc = spawn(process.execPath, nodeArgs); diff --git a/lib/watch.js b/lib/watch.js index 8e2cde4..1190b2d 100644 --- a/lib/watch.js +++ b/lib/watch.js @@ -9,5 +9,7 @@ module.exports = function ($logger, $projectData, $errors, hookArgs) { } } - return compiler.runTypeScriptCompiler($logger, $projectData.projectDir, { watch: true, release: $projectData.$options.release }); + const watchAllFiles = hookArgs && hookArgs.config && hookArgs.config.appFilesUpdaterOptions && hookArgs.config.appFilesUpdaterOptions.watchAllFiles; + + return compiler.runTypeScriptCompiler($logger, $projectData.projectDir, { watch: true, release: $projectData.$options.release, watchAllFiles: watchAllFiles }); }