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] add kit to ssr.noExternal in dev mode #2332

Merged
merged 5 commits into from
Aug 31, 2021
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/witty-maps-pull.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@sveltejs/kit': patch
---

Actually add `@sveltejs/kit` to noExternal in dev server
10 changes: 4 additions & 6 deletions packages/kit/src/core/build/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -488,12 +488,10 @@ async function build_server(
}
},
ssr: {
noExternal: [
'@sveltejs/kit', // TODO: see https://github.com/vitejs/vite/issues/3953
Copy link
Member

Choose a reason for hiding this comment

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

we still need it in build, right? i'd think build and dev should be the same

Copy link
Member Author

Choose a reason for hiding this comment

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

The issue says it works on build using adapter-node, not tested with other adapters yet, but I guess it makes sense to have them on both.

// @ts-expect-error - ssr is considered in alpha, so not yet exposed by Vite
...((vite_config.ssr && vite_config.ssr.noExternal) || []),
...svelte_packages
]
// note to self: this _might_ need to be ['svelte', '@sveltejs/kit', ...other_packages]
// but I'm honestly not sure. roll with this for now and see if it's ok
// @ts-expect-error - ssr is considered in alpha, so not yet exposed by Vite
noExternal: [...((vite_config.ssr && vite_config.ssr.noExternal) || []), ...svelte_packages]
benmccann marked this conversation as resolved.
Show resolved Hide resolved
}
});

Expand Down
8 changes: 6 additions & 2 deletions packages/kit/src/core/dev/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,12 @@ class Watcher extends EventEmitter {
}
},
ssr: {
// @ts-expect-error - ssr is considered in alpha, so not yet exposed by Vite
noExternal: [...((vite_config.ssr && vite_config.ssr.noExternal) || []), ...svelte_packages]
noExternal: [
'@sveltejs/kit', // TODO: see https://github.com/vitejs/vite/issues/3953
// @ts-expect-error - ssr is considered in alpha, so not yet exposed by Vite
...((vite_config.ssr && vite_config.ssr.noExternal) || []),
benmccann marked this conversation as resolved.
Show resolved Hide resolved
...svelte_packages
]
},
base: this.config.kit.paths.assets.startsWith('/') ? `${this.config.kit.paths.assets}/` : '/'
});
Expand Down