Skip to content
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

fix: do not copy vite manifest instead of removing during build #10782

Merged
merged 11 commits into from
Sep 26, 2023

Conversation

eltigerchino
Copy link
Member

@eltigerchino eltigerchino commented Sep 25, 2023

fixes #10268

I can't reproduce the original issue on my system but this simple fix makes it worth leaving the Vite manifest file alone?
We can just remove it when copying files so it doesn't get exposed publicly. #8360 #8815

This would also make it forwards compatible with whatever vite files get generated in the future since Vite 5 will put all these files in the .vite folder. vitejs/vite#9636 (comment) https://github.com/vitejs/vite/pull/14230/files

Please don't delete this checklist! Before submitting the PR, please make sure you do the following:

  • It's really useful if your PR references an issue where it is discussed ahead of time. In many cases, features are absent for a reason. For large changes, please create an RFC: https://github.com/sveltejs/rfcs
  • This message body should clearly illustrate what problems it solves.
  • Ideally, include a test that fails without this PR but passes with it.

Tests

  • Run the tests with pnpm test and lint the project with pnpm lint and pnpm check

Changesets

  • If your PR makes a change that should be noted in one or more packages' changelogs, generate a changeset by running pnpm changeset and following the prompts. Changesets that add features should be minor and those that fix bugs should be patch. Please prefix changeset messages with feat:, fix:, or chore:.

@changeset-bot
Copy link

changeset-bot bot commented Sep 25, 2023

🦋 Changeset detected

Latest commit: 64d187d

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

This PR includes changesets to release 1 package
Name Type
@sveltejs/kit 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

Copy link
Member

@benmccann benmccann left a comment

Choose a reason for hiding this comment

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

I'm not really sure this is a good idea. It kind of seems like it'd just be papering over whatever the root cause is. I don't know what's going to happen if you run two builds in parallel even if you leave that file in place. And I don't expect this would actually fix the issue anyway because you're not moving it to happen very much later. Finally, I'm worried that some adapter might copy files in their own custom way and then be left with the manifest in their build

@eltigerchino
Copy link
Member Author

Yeah, I have to agree. I had these two concerns as well.

  • papering over whatever the root cause is
  • some adapter might copy files in their own custom way and then be left with the manifest in their build

However,

And I don't expect this would actually fix the issue anyway because you're not moving it to happen very much later.

It should address the issue if we leave the manifest in .svelte-kit/output/... because it only errors when trying to read it there. We only remove it in the actual build output.

I'm worried that some adapter might copy files in their own custom way and then be left with the manifest in their build

If they did have a custom copying process, maybe they should also have the responsibility of not copying the Vite files over. Alternatively, we could move the Vite build artefacts outside the client and server bundle directories into its own thing? (and rename them .vite/client-manifest.json and .vite/server-manifest.json

Copy link
Member

@benmccann benmccann left a comment

Choose a reason for hiding this comment

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

Ah, right. Thanks for clarifying. I think that's probably an okay idea then. There have been times where I would have found it very helpful to have the Vite manifest for debugging, so leaving it in the .svelte-kit output and then just having the adapter skip copying it could be helpful

@benmccann benmccann merged commit 4b32c5b into master Sep 26, 2023
12 checks passed
@benmccann benmccann deleted the fix-missing-vite-manifest branch September 26, 2023 21:54
@github-actions github-actions bot mentioned this pull request Sep 26, 2023
@eltigerchino eltigerchino changed the title fix: move Vite file removal to adapter methods fix: ignore vite manifest instead of removing during build Oct 5, 2023
@eltigerchino eltigerchino changed the title fix: ignore vite manifest instead of removing during build fix: do not copy vite manifest instead of removing during build Oct 5, 2023
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.

Missing "vite-manifest.json" file on build
2 participants