Skip to content

Conversation

dominikg
Copy link
Member

extension in runtimes that support it.

Should .cjs be removed? The --experimental-modules flag 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

@jasonlyu123
Copy link
Member

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.

@dummdidumm
Copy link
Member

What do you mean by find-up?
The reason we go up/down the tree is that we need to discover the config file before a potential typescript language service is instantiated, whose setting might be influenced by what's in the Svelte config.

@dominikg
Copy link
Member Author

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 app/ but outside there is one

svelte.config.js
app/package.json
app/vite.config.js
app/src/App.svelte

extra svelte config inside src is closer than the one in app/

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?

Comment on lines +38 to +40
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
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was also unflagged in 22.18: https://github.com/nodejs/node/blob/00a42d82053e2f59ef4130cd0fe9a85b623a64be/doc/changelogs/CHANGELOG_V22.md#22.18.0.

Suggested change
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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants