From 04a94fa611d7f83728a37ad4fc66292fbb286622 Mon Sep 17 00:00:00 2001 From: Fathy Date: Tue, 24 Jul 2018 00:52:16 +0200 Subject: [PATCH] Use esnext target with TypeScript and scope hoist --- src/assets/TypeScriptAsset.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/assets/TypeScriptAsset.js b/src/assets/TypeScriptAsset.js index e12325a438c..715a8ea94c2 100644 --- a/src/assets/TypeScriptAsset.js +++ b/src/assets/TypeScriptAsset.js @@ -12,7 +12,9 @@ class TypeScriptAsset extends Asset { let typescript = await localRequire('typescript', this.name); let transpilerOptions = { compilerOptions: { - module: typescript.ModuleKind.CommonJS, + module: this.options.scopeHoist + ? typescript.ModuleKind.ESNext + : typescript.ModuleKind.CommonJS, jsx: typescript.JsxEmit.Preserve, // it brings the generated output from TypeScript closer to that generated by Babel