From 6d4f4e8adaf1b523d3d1cc9165b0f2da8a80f2c1 Mon Sep 17 00:00:00 2001 From: Fathy Boundjadj Date: Tue, 24 Jul 2018 01:05:53 +0200 Subject: [PATCH] Use esnext target with TypeScript and scope hoist (#1781) Should bring a noticeable size improvement on big TypeScript apps --- packages/core/parcel/src/assets/TypeScriptAsset.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/core/parcel/src/assets/TypeScriptAsset.js b/packages/core/parcel/src/assets/TypeScriptAsset.js index e12325a438c..715a8ea94c2 100644 --- a/packages/core/parcel/src/assets/TypeScriptAsset.js +++ b/packages/core/parcel/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