如何更改端口SolidJS服务器在本地环境中运行的内容

发布于 2025-02-03 20:32:43 字数 108 浏览 2 评论 0原文

最初设置实体并以npm start开始启动,它将在http:// localhost:3000/上运行。

您如何更改它运行的端口?

After initally setting up Solid and starting it with npm start it runs on http://localhost:3000/.

How do you change what port it runs on?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

甜扑 2025-02-10 20:32:43

VITE是用于运行本地服务器环境的软件包。

您可以在名为vite.config.ts的文件中更改其设置。

默认情况下,设置不在那里,但是您可以这样设置:

import { defineConfig } from 'vite';
import solidPlugin from 'vite-plugin-solid';

export default defineConfig({
  plugins: [solidPlugin()],
  server: { port: 3001 }, // <-- add this line
  build: {
    target: 'esnext',
    polyfillDynamicImport: false,
  },
});

有关此设置和其他设置的文档可以在 vite文档

vite is the package that is used to run the local server environment.

You can change it's settings in a file called vite.config.ts.

By default the setting isn't in there, but you can set it like so:

import { defineConfig } from 'vite';
import solidPlugin from 'vite-plugin-solid';

export default defineConfig({
  plugins: [solidPlugin()],
  server: { port: 3001 }, // <-- add this line
  build: {
    target: 'esnext',
    polyfillDynamicImport: false,
  },
});

Documentation about this and other settings can be found in the vite documentation

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文