Vite 开发服务器模式有多个入口点吗?

Atl*_*inx 7 vite

当 Vite 作为开发服务器运行时(使用 ),是否可以让多个 html 入口点在 Vite 中工作vite --host?我目前正在使用这篇文章的解决方案Multiple Entry Points in Vite,但它仅适用于将站点构建到dist文件夹时。

小智 2

对于任何带着同样问题来到这里的人。摘自Vite指南

\n
\n

假设您有以下源代码结构:

\n
\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 package.json\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 vite.config.js\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 index.html\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 main.js\n\xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 nested\n    \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 index.html\n    \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 nested.js\n
Run Code Online (Sandbox Code Playgroud)\n

在开发过程中,只需导航或链接到 /nested/ - 它会按预期工作,就像普通的静态文件服务器一样。

\n
\n