From 7d08db2191526524bf9a7a45b97952c533a6aa74 Mon Sep 17 00:00:00 2001 From: Kitson Kelly Date: Mon, 14 Jan 2019 15:18:42 +1000 Subject: [PATCH] Fix JSON Modules (#1514) --- js/compiler.ts | 1 + js/compiler_test.ts | 1 + tests/020_json_modules.ts | 5 ++--- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/js/compiler.ts b/js/compiler.ts index 842ee77b39..f38330c04a 100644 --- a/js/compiler.ts +++ b/js/compiler.ts @@ -137,6 +137,7 @@ export class Compiler private readonly _options: ts.CompilerOptions = { allowJs: true, checkJs: true, + esModuleInterop: true, module: ts.ModuleKind.ESNext, outDir: "$deno$", resolveJsonModule: true, diff --git a/js/compiler_test.ts b/js/compiler_test.ts index c5b2ca289f..771fbcc6b6 100644 --- a/js/compiler_test.ts +++ b/js/compiler_test.ts @@ -506,6 +506,7 @@ test(function compilerGetCompilationSettings() { const expectedKeys = [ "allowJs", "checkJs", + "esModuleInterop", "module", "outDir", "resolveJsonModule", diff --git a/tests/020_json_modules.ts b/tests/020_json_modules.ts index 71c0eb8db0..fdc85c4409 100644 --- a/tests/020_json_modules.ts +++ b/tests/020_json_modules.ts @@ -1,3 +1,2 @@ -import * as config from "./subdir/config.json"; -// TODO Shouldn't need 'default' -console.log(JSON.stringify(config["default"])); +import config from "./subdir/config.json"; +console.log(JSON.stringify(config));