Skip to content

Commit

Permalink
use import helper in lazy route and runtime path normalization
Browse files Browse the repository at this point in the history
  • Loading branch information
edivados committed Nov 5, 2023
1 parent 0d0e6b6 commit 39a332d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 3 additions & 1 deletion packages/start-new/config/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@ import defu from "defu";
import { join } from "node:path";
import { fileURLToPath } from "node:url";
import { createApp, resolve } from "vinxi";
import { normalize } from "vinxi/lib/path";
import { config } from "vinxi/plugins/config";
import solid from "vite-plugin-solid";
import { SolidStartClientFileRouter, SolidStartServerFileRouter } from "./fs-router.js";
import { serverComponents } from "./server-components.js";

const DEFAULT_EXTENSIONS = ["js", "jsx", "ts", "tsx"];

function solidStartClientFsRouter(config) {
Expand Down Expand Up @@ -105,7 +107,7 @@ export function defineConfig(baseConfig = {}) {
config("user", userConfig),
...plugins,
serverFunctions.client({
runtime: fileURLToPath(new URL("./server-runtime.jsx", import.meta.url))
runtime: normalize(fileURLToPath(new URL("./server-runtime.jsx", import.meta.url)))
}),
start.islands ? serverComponents.client() : null,
solid({ ssr: start.ssr, extensions: extensions.map(ext => `.${ext}`) }),
Expand Down
4 changes: 1 addition & 3 deletions packages/start-new/shared/lazyRoute.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@ export default function lazyRoute(
if (import.meta.env.DEV) {
let manifest = import.meta.env.SSR ? serverManifest : clientManifest;

const mod = await import(
/* @vite-ignore */ manifest.inputs[component.src].output.path
);
const mod = await manifest.inputs[component.src].import();
if (!mod[exported]) console.error(`Module ${component.src} does not export ${exported}`)
const Component = mod[exported];
let assets = await clientManifest.inputs?.[component.src].assets();
Expand Down

0 comments on commit 39a332d

Please sign in to comment.