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.
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 andimport.meta.env
replacedprocess.env
)!If we don't put a
module
value, Typescript uses an implicit default:Since our target is
esnext
, the implicit default isES6
. We can't use useimport.meta
withmodule
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 putesnext
to match our target.Left to do