-
-
Notifications
You must be signed in to change notification settings - Fork 98
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: enable prebundling by default (#494)
* feat: enable prebundleSvelteLibraries by default * docs: add information about switching from deep imports to package imports for prebundled * docs: update prebundling faq * docs: update changeset to remove outdated advice * docs: Apply suggestions from code review Co-authored-by: Ben McCann <322311+benmccann@users.noreply.github.com> * docs: improve recommendations * fix: make sure prebundleSvelteLibraries is not used for build or ssr * docs: Apply suggestions from code review Co-authored-by: Ben McCann <322311+benmccann@users.noreply.github.com> * docs: Apply suggestions from code review Co-authored-by: Bjorn Lu <bjornlu.dev@gmail.com> * docs: update follow-up wording after previous changes * fix: only enable prebundleSvelteLibraries for dev, log warnings if it is enabled during build or ssr * docs: update default value in docs * fix: remove warning for ssr.optimizeDeps, we don't add the svelte esbuild plugin for that so it does whatever, but won't break because of prebundleSvelteLibraries * Apply suggestions from code review Co-authored-by: Bjorn Lu <bjornlu.dev@gmail.com> Co-authored-by: Ben McCann <322311+benmccann@users.noreply.github.com> Co-authored-by: Bjorn Lu <bjornlu.dev@gmail.com>
- Loading branch information
1 parent
079a7b8
commit 8d39420
Showing
8 changed files
with
198 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
'@sveltejs/vite-plugin-svelte': minor | ||
--- | ||
|
||
enable `prebundleSvelteLibraries` during dev by default to improve page loading for the dev server. | ||
|
||
see the [FAQ](https://github.com/sveltejs/vite-plugin-svelte/blob/main/docs/faq.md#what-is-going-on-with-vite-and-pre-bundling-dependencies) for more information about `prebundleSvelteLibraries` and how to tune it. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 1 addition & 14 deletions
15
packages/e2e-tests/package-json-svelte-field/__tests__/package-json-svelte-field.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,5 @@ | ||
import { getText, isBuild, readVitePrebundleMetadata } from '~utils'; | ||
import { getText } from '~utils'; | ||
|
||
test('should render component imported via svelte field in package.json', async () => { | ||
expect(await getText('#test-id')).toBe('svelte field works'); | ||
}); | ||
|
||
if (!isBuild) { | ||
test('should optimize nested cjs deps of excluded svelte deps', () => { | ||
const metadataFile = readVitePrebundleMetadata(); | ||
const metadata = JSON.parse(metadataFile); | ||
const optimizedPaths = Object.keys(metadata.optimized); | ||
expect(optimizedPaths).not.toContain('e2e-test-dep-svelte-nested'); | ||
expect(optimizedPaths).not.toContain('e2e-test-dep-svelte-simple'); | ||
expect(optimizedPaths).toContain( | ||
'e2e-test-dep-svelte-nested > e2e-test-dep-svelte-simple > e2e-test-dep-cjs-only' | ||
); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters