-
-
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
Ignore Vite timestamp files by default in create-svelte
templates (added to .gitignore
)
#7660
Ignore Vite timestamp files by default in create-svelte
templates (added to .gitignore
)
#7660
Conversation
…added to `.gitignore`)
🦋 Changeset detectedLatest commit: c82a99d 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 |
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.
I see these from time to time - what are these files about, anyway? FWIW they aren't ignored by the Vite starter templates either, so I'm hesitant to put them in there.
Vite bundles the config files with esbuild by default and writes them to disk to |
vite creates a micro bundle of vite config to load it. thats it. they can sometimes be left as residue if the process crashes / terminates at the wrong moment. ignoring them is the right call and should be done in vite too cc @bluwy |
Sometimes you cancel vite build process, and then they stuck there, and you may commit them by mistake (it happened also here in this repo!) Additional context of Vite: vitejs/vite#9470 (comment) |
alternatively vite could instead put that file into |
Writing to a different directory would require rewriting the import paths. I think Vite should make sure the config files are removed instead on process exit to make it transparent. |
messing with process.onExit at least used to have implications for signal handling and it only lessens the impact. you could still end up with it staged when you run |
The issue is that we don't want to leak an implementation detail into a user file though, i think deleting on process exit is probably good enough in most case to prevent another point of configuration. |
I guess the question is whether this change is likely to land in Vite any time soon? I've definitely been bitten by this in the past, adding a couple of lines to a |
Can't you emulate them and pass the content of a virtual file to ESBuild instead of writing to the disk? Is this possible in ESBuild? |
IIUC the timestamped file is the output of esbuild rather than the input — it's the thing that Vite imports. I'm personally of the view that esbuild shouldn't be involved at all here — just require |
Added a note to the Vite 4 discussion proposing removing the config bundling step vitejs/vite#10570 (comment) |
I tried to make a fix to clean the files but nodejs makes it incredibly hard to detect process exit without caveats
We are writing the result of the esbuild output to disk for nodejs to evaluate it. |
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.
If the change is non-trivial then I'm ok with adding these to ignore
Because why new SvelteKit users need to figure this out by themselves?
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
pnpm changeset
and following the prompts. All changesets should bepatch
until SvelteKit 1.0