wasp-lang / wasp

The fastest way to develop full-stack web apps with React & Node.js.
https://wasp-lang.dev
MIT License
12.76k stars 1.14k forks source link

Adds `"module"` to `tsconfig.json` #2012

Closed infomiho closed 1 month ago

infomiho commented 2 months ago

Closes #1989

Investigation: Default tsconfig.json that Vite uses includes a "module" option, while our setup does not. This has been the case since the Wasp version 0.9.0 (when we introduced Vite and import.meta.env replaced process.env)!

If we don't put a module value, Typescript uses an implicit default:

Default:
CommonJS if "target" is ES3 or ES5; 
ES6/ES2015 otherwise.

Since our target is esnext, the implicit default is ES6. We can't use use import.meta with module set to ES6, since it's too low and Typescript complains. We need to put some value explicitly which is at least ES2020, so we put esnext to match our target.

Left to do