Skip to content

Commit

Permalink
use real preset in production
Browse files Browse the repository at this point in the history
  • Loading branch information
edivados committed Dec 20, 2024
1 parent a360e6b commit 44589bf
Show file tree
Hide file tree
Showing 6 changed files with 196 additions and 177 deletions.
17 changes: 3 additions & 14 deletions cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const command = defineCommand({
{
load(id) {
if (id.endsWith("nitro-dev.mjs")) {
return readFileSync(fileURLToPath(new URL("./server/presets/runtime/nitro-dev.mjs", import.meta.url)), "utf-8");
return readFileSync(fileURLToPath(new URL("./server/_nitro/runtime/nitro-dev.mjs", import.meta.url)), "utf-8");
}
}
}
Expand All @@ -53,29 +53,18 @@ const command = defineCommand({
await vite.build();

const { fileURLToPath } = await import('node:url');
const { readFileSync } = await import('node:fs');
const { createNitro, prepare, copyPublicAssets, build } = await import("nitropack");
const nitro = await createNitro({
compatibilityDate: '2024-12-20',
srcDir: 'server',
renderer: 'renderer.ts',
preset: 'server/presets/node',
publicAssets: [
{
baseURL: "/",
dir: fileURLToPath(new URL("./dist", import.meta.url)),
},
],
rollupConfig: {
plugins: [
{
load(id) {
if (id.endsWith("node-server.mjs")) {
return readFileSync(fileURLToPath(new URL("./server/presets/runtime/node-server.mjs", import.meta.url)), "utf-8");
}
}
}
]
}
]
});
await prepare(nitro);
await copyPublicAssets(nitro);
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"devDependencies": {
"@types/ws": "^8.5.13",
"citty": "^0.1.6",
"destr": "^2.0.3",
"httpxy": "^0.1.5",
"vite": "^6.0.5",
"vite-plugin-solid": "^2.11.0"
Expand Down
Loading

0 comments on commit 44589bf

Please sign in to comment.