Open
Description
Does this issue occur when all extensions are disabled?: Yes
- VS Code Version: 1.69.2
- OS Version: macOS 12.4
- TypeScript Version: 4.7.4
Steps to Reproduce:
- Create an
npm
package. Install[email protected]
andpretty-ms
. - Set
tsconfig.json
as:
{
"compilerOptions": {
"target": "esnext",
"lib": ["dom", "esnext"],
"skipLibCheck": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"module": "NodeNext",
"moduleResolution": "NodeNext"
},
"include": ["./src/**/*"]
}
- Add
"type": "module"
inpackage.json
- Following error messages are displayed by VSCode in a file with
.ts
extension undersrc/
:
// Cannot find module 'pretty-ms' or its corresponding type declarations. ts(2307)
import ms from "pretty-ms";
// The 'import.meta' meta-property is not allowed in files which will build into CommonJS output. ts(1470)
console.log(import.meta.url);
tsc
throws no errors.- Change below values in
tsconfig.json
{
"module": "esnext",
"moduleResolution": "node"
}
- VSCode no longer throws any errors.