-
-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support svelte.config.ts
#4031
Support svelte.config.ts
#4031
Conversation
🦋 Changeset detectedLatest commit: 90bdfda The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
I don't know how I feel about this. It feels wrong to support this half-way. There's not much value if you can use this in your build but your IDE/other tooling can't deal with it. This doesn't mean I'm not open to changing this on the tooling-side of things btw. |
@dummdidumm Yea pretty much. It does run the config file fine, then you inevitably find out the language server highlights your codebase in red. If anything, this could help in the future. |
const resolved_config = await loadConfigFromFile( | ||
{ | ||
command: 'build', | ||
mode: process.env.NODE_ENV || 'production' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the || 'production'
shouldn't be needed because it is done here:
Line 91 in a8a3b14
process.env.NODE_ENV = process.env.NODE_ENV || 'production'; |
i'm worried that this might be putting it into production
mode when you run svelte-kit dev
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe this command needs a || 'production'
(?)
Lines 147 to 153 in a8a3b14
prog | |
.command('package') | |
.describe('Create a package') | |
.option('-d, --dir', 'Destination directory', 'package') | |
.action(async () => { | |
try { | |
const config = await load_config(); |
Otherwise, I considered using development
as the default value for NODE_ENV
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, it seems reasonable to add a production
default to the package
command
It seems somewhat reasonable to me. I'm not sure we should assume everyone uses VS Code. I'm a bit more split on whether we'd want to advertise it in the docs or not. Maybe we should caveat it there by saying the VS Code extension doesn't support it yet |
I'm a strong 👎 on this. It adds moving parts to something that should be extremely simple and foolproof, and does so using an undocumented (and thus liable to change) API that's designed to load a Vite config, not a SvelteKit config (even if it happens to work today, is it guaranteed to work in future, despite whatever changes — to either Vite or Kit — we haven't anticipated?). As noted above, it will also cause problems with other tooling. You can already type your config files (as shown throughout the docs). The use case presented in #2576 isn't something we should encourage in the first place (I didn't actually realise that we're promoting it in the FAQ; I should pay more attention to that page). The cost to benefit ratio is all wrong. |
-1 for me too. This wouldn't work for |
I'm going to close this as the consensus seems to be that it's not a change we should make. Perhaps we can address it at an ecosystem level eventually per the mentioned RFC. Thanks |
This is a continuation of #1919 and most likely #2576, making use of Vite's
loadConfigFromFile
to handle TypeScript config file. For now this was only tested on a local SvelteKit project.As mentionned in most threads, the remaining issue/quirk is making it work with other Svelte tools (like the VSCode plugin, which is expecting a
svelte.config.js
file).Please don't delete this checklist! Before submitting the PR, please make sure you do the following:
Tests
pnpm test
and lint the project withpnpm lint
andpnpm check
Changesets
pnpx changeset
and following the prompts. All changesets should bepatch
until SvelteKit 1.0