Template
The sandbox loads Vite's native tools as WASI (NAPI_RS_FORCE_WASI=error) and only ships glue for rolldown 1.1.x. Vite 8.3 pulls rolldown 1.2.x, whose binding needs emnapi 2.0 alpha, so boot failed with 'WASI binding not found'. Match the runtime-host harness TanStack sample instead: - Pin vite 8.1.3, rolldown + @rolldown/binding-wasm32-wasi 1.1.4, @vitejs/plugin-react 6.0.0, tailwindcss + @tailwindcss/vite 4.3.1 (exact versions: the sandbox resolves package.json, not yarn.lock) - Drop Nitro (it brings rolldown 1.2.x) and the Vercel config - Hono now sits in src/server.ts, Start's server entry, routing /api/* ahead of start.fetch, as in the harness - dev runs 'vite dev --host 0.0.0.0 --port 3000'; config is .mjs - Await product recommendations in the loader to fix a hydration mismatch between the SSR skeleton and the settled client render Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
28 lines
828 B
JavaScript
28 lines
828 B
JavaScript
import { defineConfig } from 'vite';
|
|
import { tanstackStart } from '@tanstack/react-start/plugin/vite';
|
|
import react from '@vitejs/plugin-react';
|
|
import tailwindcss from '@tailwindcss/vite';
|
|
import { fileURLToPath, URL } from 'node:url';
|
|
|
|
// Absolute origin for canonical and Open Graph URLs. Inlined at build time so
|
|
// the server render and the client agree on it; set VITE_SITE_URL in production.
|
|
const siteUrl = process.env.VITE_SITE_URL ?? 'http://localhost:3000';
|
|
|
|
export default defineConfig({
|
|
server: { port: 3000 },
|
|
plugins: [
|
|
// Start must come before the React plugin.
|
|
tanstackStart(),
|
|
react(),
|
|
tailwindcss(),
|
|
],
|
|
define: {
|
|
'import.meta.env.VITE_SITE_URL': JSON.stringify(siteUrl),
|
|
},
|
|
resolve: {
|
|
alias: {
|
|
'@': fileURLToPath(new URL('./src', import.meta.url)),
|
|
},
|
|
},
|
|
});
|