打包后,异步组件编译成__vitePreload加载,需要模块js相对路径,而不是url相对路径。
Version
3.0.11
Reproduction link
[https://sfc.vuejs.org/#eyJBcHAudnVlIjoiPHRlbXBsYXRlPlxuICA8aDE e3sgbXNnIH19PC9oMT5cbjwvdGVtcGxhdGU XG5cbjxzY3JpcHQgc2V0dXA XG5pbXBvcnQge2RlZmluZUFzeW5jQ29tcG9uZW50LCBkZWZpbmVDb21wb25lbnR9IGZyb20gJ3Z1ZSc7XG5jb25zdCBIZWxsb1dvcmxkID0gZGVmaW5lQXN5bmNDb21wb25lbnQoKCkgPT4gaW1wb3J0KCcuL2NvbXBvbmVudHMvSGVsbG9Xb3JsZC52dWUnKSlcbmNvbnN0IG1zZyA9ICdIZWxsbyBXb3JsZCEnXG48L3NjcmlwdD4ifQ==](https://sfc.vuejs.org/#eyJBcHAudnVlIjoiPHRlbXBsYXRlPlxuICA8aDE e3sgbXNnIH19PC9oMT5cbjwvdGVtcGxhdGU XG5cbjxzY3JpcHQgc2V0dXA XG5pbXBvcnQge2RlZmluZUFzeW5jQ29tcG9uZW50LCBkZWZpbmVDb21wb25lbnR9IGZyb20gJ3Z1ZSc7XG5jb25zdCBIZWxsb1dvcmxkID0gZGVmaW5lQXN5bmNDb21wb25lbnQoKCkgPT4gaW1wb3J0KCcuL2NvbXBvbmVudHMvSGVsbG9Xb3JsZC52dWUnKSlcbmNvbnN0IG1zZyA9ICdIZWxsbyBXb3JsZCEnXG48L3NjcmlwdD4ifQ==)
Steps to reproduce
const HelloWorld = defineAsyncComponent(() => __vitePreload(() => import("./HelloWorld.699d1cd2.js"), true ? ["/assets/HelloWorld.699d1cd2.js","/assets/HelloWorld.fd7ce5b2.css"] : void 0));
What is expected?
打包后,异步组件编译成__vitePreload加载,需要模块js相对路径,而不是url相对路径。
What is actually happening?
vite打包后似乎只能根目录启动,不能放到我的web其他目录使用,我想做成vue插件,这似乎不太好实现