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] change Vite's output directory from _app to client #5620

Merged
merged 3 commits into from Jul 19, 2022
Merged

Conversation

benmccann
Copy link
Member

@benmccann benmccann commented Jul 19, 2022

This fixes an issue that @userquin ran into trying to make vite-plugin-pwa work with SvelteKit. He was using Vite/Rollup's emit to output a service worker manifest and expecting it to be served from the root directory, but it was ending up under _app. _app is arguable only for stuff generated by SvelteKit though. I could imagine lots of other things like a robots.txt or something you might want to generate with a Vite plugin that need to go in a certain location and are impossible to put there today.

I also think the code ends up being a little nicer this was as we don't end up having to specify the app dir in quite as many places

I'm splitting this out from #5601 as that PR was becoming too unwieldy

@changeset-bot
Copy link

changeset-bot bot commented Jul 19, 2022

🦋 Changeset detected

Latest commit: 5eddc20

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

@Rich-Harris
Copy link
Member

This introduces a very minor bug — workers are no longer written to _app/assets/worker-xyz123.js, but are instead written to assets/worker-xyz123.js. Neither behaviour is correct (ideally it would be _app/immutable/worker-xyz123.js; that will be possible with the next release of Vite thanks to vitejs/vite#9212), but putting workers outside _app feels slightly naughtier.

Not enough to prevent merging this PR, but worth noting nonetheless

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.

None yet

2 participants