Skip to content

Commit

Permalink
fix: add svelte/internal/disclose-version to optimizeDeps.include (#692)
Browse files Browse the repository at this point in the history
* fix: add svelte/internal/disclose-version  to optimizeDeps.include

* fix: only add import for svelte4
  • Loading branch information
dominikg authored Jul 21, 2023
1 parent 0e7092e commit a8f13f0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/dirty-carrots-clap.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@sveltejs/vite-plugin-svelte': patch
---

add svelte/internal/disclose-version to vite config optimizeDeps.include by default
6 changes: 6 additions & 0 deletions packages/vite-plugin-svelte/src/utils/constants.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { isSvelte3 } from './svelte-version.js';

export const VITE_RESOLVE_MAIN_FIELDS = ['module', 'jsnext:main', 'jsnext'];

export const SVELTE_RESOLVE_MAIN_FIELDS = ['svelte'];
Expand All @@ -12,6 +14,10 @@ export const SVELTE_IMPORTS = [
'svelte/transition',
'svelte'
];
// TODO add to global list after dropping svelte 3
if (!isSvelte3) {
SVELTE_IMPORTS.push('svelte/internal/disclose-version');
}

export const SVELTE_HMR_IMPORTS = [
'svelte-hmr/runtime/hot-api-esm.js',
Expand Down

0 comments on commit a8f13f0

Please sign in to comment.