feat: add support for loading svelte config with .ts or .mts#2804
feat: add support for loading svelte config with .ts or .mts#2804dominikg wants to merge 1 commit intosveltejs:masterfrom
Conversation
…n in runtimes that support it
|
The reason why it's a find-up is that the original version, before ESM support, is handled by cosmiconfig. Not sure if there is anyone actually using it. |
|
What do you mean by find-up? |
|
in these situations, language-tools might use a svelte.config.js file that sveltekit or vite-plugin-svelte would ignore: no svelte.config.js inside svelte.config.js
app/package.json
app/vite.config.js
app/src/App.svelteextra svelte config inside src is closer than the one in app/package.json
app/vite.config.js
app/svelte.config.js
app/src/foo/App.svelte
app/src/svelte.config.js ideally it would be able to discover svelte app root by some kind of heuristic, eg .git or package manager lock, package.json and svelte.config.js in same dir and package.json has svelte in deps? |
| const add_experimental_strip_types_flag = | ||
| (node_major === 22 && node_minor > 5) || // added behind flag in 22.6.0 | ||
| (node_major === 23 && node_minor < 6); // unflagged in 23.6 |
There was a problem hiding this comment.
It was also unflagged in 22.18: https://github.com/nodejs/node/blob/00a42d82053e2f59ef4130cd0fe9a85b623a64be/doc/changelogs/CHANGELOG_V22.md#22.18.0.
| const add_experimental_strip_types_flag = | |
| (node_major === 22 && node_minor > 5) || // added behind flag in 22.6.0 | |
| (node_major === 23 && node_minor < 6); // unflagged in 23.6 | |
| const add_experimental_strip_types_flag = | |
| (node_major === 22 && node_minor > 5 && node_minor < 18) || // added behind flag in 22.6, unflagged in 22.18 | |
| (node_major === 23 && node_minor < 6); // unflagged in 23.6 |
extension in runtimes that support it.
Should .cjs be removed? The
--experimental-modulesflag is probably not required anymore either.TODO: tests
Question: why is the config loader using find-up? As far as i am aware svelte config isn't discovered that way by other tools like sveltekit or vite-plugin-svelte, leading to potential mismatches if there is a stray svelte.config.js file deeper down in the source tree