-
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
59 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
export { ssrEffect } | ||
|
||
import type { ConfigEffect } from 'vike/types' | ||
|
||
function ssrEffect({ configDefinedAt, configValue }: Parameters<ConfigEffect>[0]): ReturnType<ConfigEffect> { | ||
if (typeof configValue !== 'boolean') throw new Error(`${configDefinedAt} should be a boolean`) | ||
const env = { | ||
// Always load on the client-side. | ||
client: true, | ||
// When the SSR flag is false, we want to render the page only on the client-side. | ||
// We achieve this by loading `Page` only on the client-side: when onRenderHtml() | ||
// gets a `Page` value that is undefined it skip server-side rendering. | ||
server: configValue !== false, | ||
} | ||
return { | ||
meta: { | ||
Page: { env }, | ||
}, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export type * from './VikeHooks' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// This is a workaround for | ||
// * https://github.com/esbuild-kit/tsx/issues/113 | ||
// * https://github.com/vuejs/core/issues/8303 | ||
// Without this, when running vike-vue with tsx (for example when scaffolding a | ||
// Vue+Express project with Bati), querying the server will fail with the | ||
// following error: | ||
// [vike][request(1)] HTTP request: / | ||
// [vite][request(1)] __name is not defined | ||
// [vite][request(1)] __name is not defined | ||
// [vite][request(1)] __name is not defined | ||
// [vite][request(1)] Error when evaluating SSR module virtual:vike:importPageCode:server:/pages/index: failed to import "/pages/index/+Page.vue" | ||
// |- ReferenceError: __name is not defined | ||
const globalName = (target: Object, value: string) => | ||
Object.defineProperty(target, 'name', { | ||
value, | ||
configurable: true, | ||
}) | ||
;(globalThis as any).__name = globalName |