From a3cf9c4594541eb518e4805bbe3f333bdeaaaad6 Mon Sep 17 00:00:00 2001 From: Bruno Lemos Date: Mon, 22 Oct 2018 15:19:18 -0300 Subject: [PATCH 1/2] Enable TypeScript json module resolver --- packages/react-scripts/config/react-app.d.ts | 5 ----- .../react-scripts/scripts/utils/verifyTypeScriptSetup.js | 1 + 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/packages/react-scripts/config/react-app.d.ts b/packages/react-scripts/config/react-app.d.ts index 5994114ffda..7a8476fa3ce 100644 --- a/packages/react-scripts/config/react-app.d.ts +++ b/packages/react-scripts/config/react-app.d.ts @@ -2,11 +2,6 @@ // Do not edit this file. It's replaced every time you launch a toolbox action. // If you need to add additional declarations, please do so in a new file. -declare module '*.json' { - const value: any; - export default value; -} - declare module '*.bmp' { const src: string; export default src; diff --git a/packages/react-scripts/scripts/utils/verifyTypeScriptSetup.js b/packages/react-scripts/scripts/utils/verifyTypeScriptSetup.js index 7f05f1ba73f..2eb5ade041d 100644 --- a/packages/react-scripts/scripts/utils/verifyTypeScriptSetup.js +++ b/packages/react-scripts/scripts/utils/verifyTypeScriptSetup.js @@ -32,6 +32,7 @@ const compilerOptions = { // This values are required and cannot be changed by the user module: { value: 'esnext', reason: 'for import() and import/export' }, moduleResolution: { value: 'node', reason: 'to match webpack resolution' }, + resolveJsonModule: { value: true, reason: 'to match webpack loader' }, isolatedModules: { value: true, reason: 'implementation limitation' }, noEmit: { value: true }, jsx: { value: 'preserve', reason: 'JSX is compiled by Babel' }, From 6f6f77a35efdcb1207f89f711fce9c76ba73c3a2 Mon Sep 17 00:00:00 2001 From: Joe Haddad Date: Mon, 22 Oct 2018 14:27:27 -0400 Subject: [PATCH 2/2] Update verifyTypeScriptSetup.js --- packages/react-scripts/scripts/utils/verifyTypeScriptSetup.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/react-scripts/scripts/utils/verifyTypeScriptSetup.js b/packages/react-scripts/scripts/utils/verifyTypeScriptSetup.js index 2eb5ade041d..b2f37244919 100644 --- a/packages/react-scripts/scripts/utils/verifyTypeScriptSetup.js +++ b/packages/react-scripts/scripts/utils/verifyTypeScriptSetup.js @@ -29,7 +29,7 @@ const compilerOptions = { allowSyntheticDefaultImports: { suggested: true }, strict: { suggested: true }, - // This values are required and cannot be changed by the user + // These values are required and cannot be changed by the user module: { value: 'esnext', reason: 'for import() and import/export' }, moduleResolution: { value: 'node', reason: 'to match webpack resolution' }, resolveJsonModule: { value: true, reason: 'to match webpack loader' },