T
TanStack3mo ago
automatic-azure

How to configure the port of the production server?

Here is the vite config
export default defineConfig({
server: {
port: 8080,
},
plugins: [
tsConfigPaths({
projects: ["./tsconfig.json"],
}),
tanstackStart({ customViteReactPlugin: true, target: "node-server" }),
viteReact(),
],
});
export default defineConfig({
server: {
port: 8080,
},
plugins: [
tsConfigPaths({
projects: ["./tsconfig.json"],
}),
tanstackStart({ customViteReactPlugin: true, target: "node-server" }),
viteReact(),
],
});
Then
pnpm build
pnpm build
pnpm start
> node .output/server/index.mjs

Listening on http://[::]:3000
pnpm start
> node .output/server/index.mjs

Listening on http://[::]:3000
I want it to listen on port 8080. Build info
✓ built in 1.04s
vite v6.3.5 building SSR bundle for production...
✓ 118 modules transformed.
[plugin vite:css-post] Sourcemap is likely to be incorrect: a plugin (vite:css-post) was used to transform files, but didn't generate a sourcemap for the transformation. Consult the plugin documentation for help
✓ built in 346ms
✔ Generated public .output/public nitro 11:43:59 am
ℹ Building Nitro Server (preset: node-server, compatibility date: 2024-11-19) nitro 11:43:59 am
✔ Nitro Server built
✓ built in 1.04s
vite v6.3.5 building SSR bundle for production...
✓ 118 modules transformed.
[plugin vite:css-post] Sourcemap is likely to be incorrect: a plugin (vite:css-post) was used to transform files, but didn't generate a sourcemap for the transformation. Consult the plugin documentation for help
✓ built in 346ms
✔ Generated public .output/public nitro 11:43:59 am
ℹ Building Nitro Server (preset: node-server, compatibility date: 2024-11-19) nitro 11:43:59 am
✔ Nitro Server built
4 Replies
automatic-azure
automatic-azureOP3mo ago
pnpm build is just "build": "vite build && tsc --noEmit",
like-gold
like-gold3mo ago
Use NITRO_PORT or PORT env variable (defaults to 3000)
automatic-azure
automatic-azureOP3mo ago
thanks, sorry for the dumb question. i just changed the script to "start": "PORT=8080 node .output/server/index.mjs" I should have just looked through the build output to figure this out
like-gold
like-gold3mo ago
Wasn't a dumb question

Did you find this page helpful?