You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit e07eedd
Browse filesBrowse the repository at this point in the historyBrowse files
fix(init): write ESM config files in CommonJS packages (#970)
In a package with `"type": "commonjs"`, which `npm init -y` writes, the
React, Vue, Svelte and Solid starters from `void init` fail in dev,
build and preview:
```
Error: Failed to resolve "@void/svelte/plugin". This package is ESM only but it was tried to load by `require`.
```
In these packages, the starters now use `vite.config.mts`, and all four
work.
An inferred env schema goes to `env.mts` there, because `void env check`
can't load `env.ts` (`Cannot use import statement outside a module`).
When `sourceDir` is set, the inferred schema now goes there, where Void
reads it, instead of to a root file Void ignores.
The warning from #176 to add `"type": "module"` is removed, because it
only showed after the Vite config had loaded as ESM, and those builds
work.
Set up a new or existing Void project. In an empty directory, choose Vite+ or Vite, a framework, and a D1, PostgreSQL, MySQL, or Static Pages starter. The new app's `void.config.ts` turns on [`routing.typedRoutes`](../config.md#routing-typedroutes).
36
+
Set up a new or existing Void project. In an empty directory, choose Vite+ or Vite, a framework, and a D1, PostgreSQL, MySQL, or Static Pages starter. For a package with `"type": "commonjs"`, starters use `vite.config.mts` and inferred env schemas use `env.mts`. The new app's `void.config.ts` turns on [`routing.typedRoutes`](../config.md#routing-typedroutes).
37
37
38
38
Pass your choices as flags to scaffold from a script or coding agent:
0 commit comments