File tree Expand file tree Collapse file tree 4 files changed +19
-1
lines changed
test/apps/basics/src/routes/remote Expand file tree Collapse file tree 4 files changed +19
-1
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ ' @sveltejs/kit ' : patch
3+ ---
4+
5+ fix: ensure environment setup is in its own chunk
Original file line number Diff line number Diff line change @@ -682,9 +682,13 @@ async function kit({ svelte_config }) {
682682 config . build . rollupOptions . output = {
683683 ...config . build . rollupOptions . output ,
684684 manualChunks ( id , meta ) {
685+ // Prevent core runtime and env from ending up in a remote chunk, which could break because of initialization order
685686 if ( id === `${ runtime_directory } /app/server/index.js` ) {
686687 return 'app-server' ;
687688 }
689+ if ( id === `${ runtime_directory } /shared-server.js` ) {
690+ return 'app-shared-server' ;
691+ }
688692
689693 // Check if this is a *.remote.ts file
690694 if ( svelte_config . kit . moduleExtensions . some ( ( ext ) => id . endsWith ( `.remote${ ext } ` ) ) ) {
Original file line number Diff line number Diff line change 99 set_count_server_set ,
1010 resolve_deferreds
1111 } from ' ./query-command.remote.js' ;
12+ import { q } from ' ./accessing-env.remote' ;
1213
1314 let { data } = $props ();
1415
1516 let command_result = $state (null );
16- let release;
17+
18+ // we just want it not to be treeshaken away
19+ q;
1720
1821 const count = browser ? get_count () : null ; // so that we get a remote request in the browser
1922 </script >
Original file line number Diff line number Diff line change 1+ import { query } from '$app/server' ;
12import { env } from '$env/dynamic/private' ;
23import { env as public_env } from '$env/dynamic/public' ;
34
45if ( ! env . PRIVATE_DYNAMIC || ! public_env . PUBLIC_DYNAMIC ) {
56 // This checks that dynamic env vars are available when prerendering remote functions
67 // https://github.com/sveltejs/kit/pull/14219
8+ // and are not in the same chunk as this one
9+ // https://github.com/sveltejs/kit/issues/14439
710 throw new Error ( 'Dynamic environment variables are not set up correctly' ) ;
811}
12+
13+ // placeholder query that needs to be imported/used elsewhere so that bundling/chunking would include env setup if not setup correctly
14+ export const q = query ( ( ) => { } ) ;
You can’t perform that action at this time.
0 commit comments