Skip to content

feat: add support for svelte config ts/mts files#3009

Open
craig-jennings wants to merge 7 commits into
sveltejs:masterfrom
craig-jennings:craig/add-config-ts-support
Open

feat: add support for svelte config ts/mts files#3009
craig-jennings wants to merge 7 commits into
sveltejs:masterfrom
craig-jennings:craig/add-config-ts-support

Conversation

@craig-jennings
Copy link
Copy Markdown
Contributor

Fixes #2834

This is a follow-up to #2804 that was closed for some reason. It'd be great to get this in because I think it's the last blocker to being able to fully adopt svelte.config.ts files in a project. The only adjustment I made was adding @jrmajor's recommendation to remove the flag for Node 22.18 because it was enabled by default on that release

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Apr 23, 2026

🦋 Changeset detected

Latest commit: 3b8013f

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
svelte-language-server Patch
svelte-check Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@jasonlyu123
Copy link
Copy Markdown
Member

jasonlyu123 commented Apr 24, 2026

The flag is still needed. The language server is using Node.js version bundled by VSCode by default. And the current supported VSCode versions still include some that need the flag.

@jasonlyu123
Copy link
Copy Markdown
Member

Sorry, never mind, I misunderstood what you meant.

I think we also don't need to add the flag when the svelte.language-server.runtime config is set. We won't know the version of the custom node.js version, and users can still use the svelte.language-server.runtime-args config to add it.

@craig-jennings
Copy link
Copy Markdown
Contributor Author

@jasonlyu123 I believe I addressed your comments in the latest commit. When you have a sec, could you take another look?

Copy link
Copy Markdown
Member

@jasonlyu123 jasonlyu123 left a comment

Choose a reason for hiding this comment

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

Found that Node.js has an API for checking if --experimental-strip-types is enabled. Can add a check to the configLoader to load ts files if it's enabled.

const loadSvelteConfigTs = 'typescript' in process.features && !!process.features.typescript

Comment thread packages/language-server/src/lib/documents/configLoader.ts Outdated
Comment thread packages/svelte-vscode/src/extension.ts Outdated
@craig-jennings craig-jennings requested a review from jasonlyu123 May 8, 2026 15:59
@craig-jennings
Copy link
Copy Markdown
Contributor Author

@jasonlyu123 Not quite sure I'm following where you're wanting loadSvelteConfigTs check to go, so feel free to update this PR as you see fit.

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.

Allow usage of svelte.config.ts

2 participants