diff --git a/packages/router-plugin/src/core/code-splitter/compilers.ts b/packages/router-plugin/src/core/code-splitter/compilers.ts index 89cdae41ad..c9c4868821 100644 --- a/packages/router-plugin/src/core/code-splitter/compilers.ts +++ b/packages/router-plugin/src/core/code-splitter/compilers.ts @@ -623,7 +623,7 @@ export function compileCodeSplitReferenceRoute( ) { programPath.unshiftContainer('body', [ template.statement( - `const ${splitNodeMeta.localImporterIdent} = () => import('${splitUrl}')`, + `const ${splitNodeMeta.localImporterIdent} = () => import('${splitUrl.replace(/'/g, "\\'")}')`, )(), ]) } @@ -719,7 +719,7 @@ export function compileCodeSplitReferenceRoute( ) { programPath.unshiftContainer('body', [ template.statement( - `const ${splitNodeMeta.localImporterIdent} = () => import('${splitUrl}')`, + `const ${splitNodeMeta.localImporterIdent} = () => import('${splitUrl.replace(/'/g, "\\'")}')`, )(), ]) } diff --git a/packages/start-server-core/src/createStartHandler.ts b/packages/start-server-core/src/createStartHandler.ts index 90d4e706f9..847ed84b10 100644 --- a/packages/start-server-core/src/createStartHandler.ts +++ b/packages/start-server-core/src/createStartHandler.ts @@ -557,7 +557,7 @@ export function createStartHandler( return normalizeSsrResponse( Response.json( { error: 'Only HTML requests are supported here' }, - { status: 500 }, + { status: 406 }, ), ) }