diff --git a/docs/content/1.guide/1.what-is-a-router.md b/docs/content/1.guide/1.what-is-a-router.md index d170a1a7..991d4653 100644 --- a/docs/content/1.guide/1.what-is-a-router.md +++ b/docs/content/1.guide/1.what-is-a-router.md @@ -26,14 +26,6 @@ A router is a specification for how a group of routes should be handled. Lets ta - The base path is available as `import.meta.env.BASE_URL`. :: -### `mode` - -::list -- The mode of the router. -- Determines how the other parts of the router are interpreted. -- The mode is available as `import.meta.env.ROUTER_MODE`. -:: - ### `routes` ::list @@ -51,12 +43,22 @@ A router is a specification for how a group of routes should be handled. Lets ta ### `plugins` ::list +- List of Vite/Rollup plugins to apply for the router. :: ### `outDir` ::list -- The output directory for the router. +- The build output directory for the router. +- This is a temporary path because eventually the routers are served by the adapter. +:: + +### `mode` + +::list +- The mode of the router. +- Determines how the other parts of the router are interpreted. +- The mode is available as `import.meta.env.ROUTER_MODE`. :: > Vinxi supports a few router modes out of the box: `"static"`, `"handler"`, `"build"`, `"spa"`. New modes can be added by you too. Lets see how each mode is different? @@ -103,12 +105,7 @@ export default createApp({ base: "/", mode: "handler", handler: "./ssr-handler.ts", - fs: { - dir: "./routes", - }, - compile: { - target: "server" - } + target: "server" ] }); ``` @@ -148,12 +145,7 @@ export default createApp({ base: "/_build", mode: "build", handler: "./client-handler.ts", - fs: { - dir: "./routes", - }, - compile: { - target: "server" - } + target: "client" ] }); ``` diff --git a/packages/vinxi-references/chunks.js b/packages/vinxi-references/chunks.js index 9eff1ca2..ed86c55d 100644 --- a/packages/vinxi-references/chunks.js +++ b/packages/vinxi-references/chunks.js @@ -12,7 +12,10 @@ function getChunks(app, routerName, modIndex) { ([name, chunk]) => chunk.file.startsWith("c_") && name !== router.handler, ) .map(([name, chunk], index) => { - const chunkPath = join(router.outDir, router.base, chunk.file); + const chunkPath = join(router.outDir, router.base, chunk.file).replace( + /\\/g, + "/", + ); return ` import * as mod_${index}_${modIndex} from '${chunkPath}'; chunks['${chunk.file}'] = mod_${index}_${modIndex}