最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

How do you change the port for a TanStack Start app? - Stack Overflow

programmeradmin1浏览0评论

I would like to update the port that my app is running on but the TanStack Start [defineConfig][1] method doesn't seem to expose that like a normal Vite config does. Here is my app.config.ts:

import { defineConfig } from "@tanstack/react-start/config";
import tsConfigPaths from "vite-tsconfig-paths";
import tailwindcss from "@tailwindcss/vite";

export default defineConfig({
  tsr: {
    appDirectory: "src",
  },
  server: {
    preset: "vercel",
  },
  vite: {
    plugins: [
      tailwindcss(),
      tsConfigPaths({
        projects: ["./tsconfig.json"],
      }),
    ],
    build: {
      rollupOptions: {
        external: ["./storage/**"], // Mark all subdirectories under storage as external
      },
    },
  },
});

Currently it always runs on port 3000. How do I set this up?

I would like to update the port that my app is running on but the TanStack Start [defineConfig][1] method doesn't seem to expose that like a normal Vite config does. Here is my app.config.ts:

import { defineConfig } from "@tanstack/react-start/config";
import tsConfigPaths from "vite-tsconfig-paths";
import tailwindcss from "@tailwindcss/vite";

export default defineConfig({
  tsr: {
    appDirectory: "src",
  },
  server: {
    preset: "vercel",
  },
  vite: {
    plugins: [
      tailwindcss(),
      tsConfigPaths({
        projects: ["./tsconfig.json"],
      }),
    ],
    build: {
      rollupOptions: {
        external: ["./storage/**"], // Mark all subdirectories under storage as external
      },
    },
  },
});

Currently it always runs on port 3000. How do I set this up?

Share Improve this question asked Mar 29 at 22:40 Code on the RocksCode on the Rocks 18k6 gold badges74 silver badges94 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

Since the current version of TanStack Start uses Vinxi under the hood, you can update your package.json scripts to pass in the port like this:

"scripts": {
    "dev": "vinxi dev --port 3008",
    "build": "vinxi build",
    "start": "vinxi start"
},

Or just the CLI command:

vinxi dev --port 3008
发布评论

评论列表(0)

  1. 暂无评论