chore: set module to esnext in tsconfig.json (#7256)

The main `tsconfig.json` file is only used for API Extractor, and by VSCode to provide type information. It is _not_ used to compile Puppeteer for shipping. Therefore we can specify `module: "esnext"` in here so that VSCode knows we can use all the latest and greatest module features (primarily, dynamic imports). In `tsconfig.cjs.json` and `tsconfig.esm.json` we set the `module` setting for CJS/ESM respectively.
This commit is contained in:
Jack Franklin 2021-05-21 11:05:41 +01:00 committed by GitHub
parent d01aa6c84a
commit 8340cb7c34
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 5 deletions

View File

@ -5,7 +5,6 @@
"checkJs": true, "checkJs": true,
"target": "ES2019", "target": "ES2019",
"moduleResolution": "node", "moduleResolution": "node",
"module": "ES2015",
"declaration": true, "declaration": true,
"declarationMap": true, "declarationMap": true,
"resolveJsonModule": true, "resolveJsonModule": true,

View File

@ -1,11 +1,15 @@
/** /**
* This configuration only exists for the API Extractor tool. See the details in * This configuration only exists for the API Extractor tool and for VSCode to use. It is NOT the tsconfig used for compilation.
* CONTRIBUTING.md that describes our TypeScript setup. * For CJS builds, `tsconfig.cjs.json` is used, and for ESM, it's `tsconfig.esm.json`.
*/ * See the details in CONTRIBUTING.md that describes our TypeScript setup.
*/
{ {
"extends": "./tsconfig.base.json", "extends": "./tsconfig.base.json",
"compilerOptions": { "compilerOptions": {
"noEmit": true "noEmit": true,
// This module setting is just for VSCode so it doesn't error when we use
// dynamic imports.
"module": "esnext"
}, },
"include": ["src"] "include": ["src"]
} }