This is an example repro to illustrate https://github.com/vitejs/vite/pull/7644#issuecomment-1126198509.
Running npm run build
(aka node index.js
) causes Vite to build src/index.js
to public/build
. Running npm start
starts a server.
public/build/app.js
includes the following:
const routes = {
home: () => __vitePreload(() => import("./chunks/home-fd4bed33.js"), true ? ["chunks/home-fd4bed33.js","assets/home-203ffc0a.css"] : void 0)
};
The dependencies are relative to /build/app.js
, and should resolve to /build/chunks/home-fd4ved33.js
and /build/assets/home-203ffc0a.css
.
The dependencies are resolved against the document's baseURI. Even in the trivial case where we're visiting /
, this breaks (/chunks/home-fd4ved33.js
and /assets/home-203ffc0a.css
), but even if we were to account for that somehow it would still be broken when we visited /some/nested/path
.
As far as I can tell, the document baseURI is irrelevant.
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。