Describe the bug
If you create a brand new Vite app and add console.log(import.meta.url) to vite.config.ts, you'll see an error in VS Code:
The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node12', or 'nodenext'. ts(1343)
Adding vite.config.ts to tsconfig.json's include array solves the issue but I wonder if there's any downsides to doing this by default. One I can think of is that vite.config.ts can rely on Node.js stuff but tsconfig.json is primarily for the browser environment if I'm not mistaken.
// tsconfig.json
"include": ["./src", "./vite.config.ts"]
Bear in mind that StackBlitz won't show you this, you'll need to download the project and open it locally.
Reproduction
https://stackblitz.com/edit/vitejs-vite-yv42yg?file=vite.config.ts
System Info
System:
OS: Linux undefined
CPU: (4) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
Memory: 0 Bytes / 0 Bytes
Shell: Unknown - /bin/jsh
Binaries:
Node: 14.16.0 - /usr/local/bin/node
Yarn: 1.22.10 - /bin/yarn
npm: 7.17.0 - /bin/npm
npmPackages:
@vitejs/plugin-react: ^1.0.7 => 1.1.3
vite: ^2.7.2 => 2.7.9
Used Package Manager
yarn
Logs
No response
Validations
Describe the bug
If you create a brand new Vite app and add
console.log(import.meta.url)tovite.config.ts, you'll see an error in VS Code:Adding
vite.config.tstotsconfig.json'sincludearray solves the issue but I wonder if there's any downsides to doing this by default. One I can think of is thatvite.config.tscan rely on Node.js stuff buttsconfig.jsonis primarily for the browser environment if I'm not mistaken.Bear in mind that StackBlitz won't show you this, you'll need to download the project and open it locally.
Reproduction
https://stackblitz.com/edit/vitejs-vite-yv42yg?file=vite.config.ts
System Info
System: OS: Linux undefined CPU: (4) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz Memory: 0 Bytes / 0 Bytes Shell: Unknown - /bin/jsh Binaries: Node: 14.16.0 - /usr/local/bin/node Yarn: 1.22.10 - /bin/yarn npm: 7.17.0 - /bin/npm npmPackages: @vitejs/plugin-react: ^1.0.7 => 1.1.3 vite: ^2.7.2 => 2.7.9Used Package Manager
yarn
Logs
No response
Validations