From 876a738e101cf0ede3337d0318ec9941d9bd25c1 Mon Sep 17 00:00:00 2001 From: Bruno Lemos Date: Mon, 22 Oct 2018 15:49:56 -0300 Subject: [PATCH] Enable TypeScript json module resolver (#5531) * Enable TypeScript json module resolver * Update verifyTypeScriptSetup.js --- packages/react-scripts/config/react-app.d.ts | 5 ----- .../react-scripts/scripts/utils/verifyTypeScriptSetup.js | 3 ++- 2 files changed, 2 insertions(+), 6 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..b2f37244919 100644 --- a/packages/react-scripts/scripts/utils/verifyTypeScriptSetup.js +++ b/packages/react-scripts/scripts/utils/verifyTypeScriptSetup.js @@ -29,9 +29,10 @@ 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' }, isolatedModules: { value: true, reason: 'implementation limitation' }, noEmit: { value: true }, jsx: { value: 'preserve', reason: 'JSX is compiled by Babel' },