Skip to content

Commit

Permalink
[fix] provide explicit JS entry point for Vite dev mode (#2134)
Browse files Browse the repository at this point in the history
  • Loading branch information
benmccann authored Aug 8, 2021
1 parent db2b869 commit 8c0ffb8
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/tough-timers-serve.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@sveltejs/kit': patch
---

[fix] provide explicit JS entry point for Vite dev mode
7 changes: 7 additions & 0 deletions packages/kit/src/core/create_app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,13 @@ export function create_app({ manifest_data, output, cwd = process.cwd() }) {

write_if_changed(`${dir}/manifest.js`, generate_client_manifest(manifest_data, base));

write_if_changed(
`${dir}/root.js`,
`import root from './root.svelte';
export default root;
`
);

write_if_changed(`${dir}/root.svelte`, generate_app(manifest_data, base));
}

Expand Down
7 changes: 7 additions & 0 deletions packages/kit/src/core/dev/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,13 @@ class Watcher extends EventEmitter {
$lib: this.config.kit.files.lib
}
},
build: {
rollupOptions: {
// Vite needs an explicit JS entry point, so we create a root.js
// that simply re-exports the root.svelte file
input: path.resolve(`${this.dir}/generated/root.js`)
}
},
plugins: [
svelte({
extensions: this.config.extensions,
Expand Down

0 comments on commit 8c0ffb8

Please sign in to comment.