-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
chore: add tests for treeshaking #13909
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
Conversation
packages/kit/test/apps/basics/src/routes/treeshaking/browser/+page.svelte
Outdated
Show resolved
Hide resolved
packages/kit/test/apps/basics/src/routes/treeshaking/dev/+page.svelte
Outdated
Show resolved
Hide resolved
….svelte Co-authored-by: Dominik G. <dominik.goepel@gmx.de>
|
…page.svelte Co-authored-by: Dominik G. <dominik.goepel@gmx.de>
), | ||
'utf-8' | ||
); | ||
expect(code).not.toContain('browser'); |
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.
above browser was changed to client, do we have to update this check too?
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 checks are actually checking for the browser
and dev
imports from $app/environment
rather than the string itself. Both shouldn't be in the output though if the treeshaking is done correctly. I changed it from "not browser" to "server" because that was causing this assertion to fail.
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.
clarified with a comment - nice work!
related to #13738
This PR adds a test to ensure that the
browser
anddev
conditions from the$app/environment
module are treeshaken. This will make the rolldown-vite ecosystem ci fail again since treeshaking isn't on par with Rollup yet rolldown/rolldown#3403If you want to see the Rolldown output, you can add the rolldown-vite override and run the tests.
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. Changesets that add features should beminor
and those that fix bugs should bepatch
. Please prefix changeset messages withfeat:
,fix:
, orchore:
.Edits