You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
我建了一个测试项目 https://github.com/thetime50/...
如果我把node_modules@time50\vite-plugin-webpackchunkname\src\index.ts目录下载的&& !nodeModuleIdSets.has(id)删除掉,在插件目录下执行npm run build。然后在项目目录下执行npm run build时就会有这样的报错
我不知道现在该怎么处理可以让chunkname插件能够支持node_nodules里的文件
[vite]: Rollup failed to resolve import "vue3-lottie?chunkName=vue-lottie" from "src/pages/demo/demo.vue".
This is most likely unintended because it can break your application at runtime.
If you do want to externalize this module explicitly add it to
`build.rollupOptions.external`
error during build:
Error: [vite]: Rollup failed to resolve import "vue3-lottie?chunkName=vue-lottie" from "src/pages/demo/demo.vue".
This is most likely unintended because it can break your application at runtime.
If you do want to externalize this module explicitly add it to
`build.rollupOptions.external`
at onRollupWarning (D:\work\ytt-pc-1\node_modules\vite\dist\node\chunks\dep-8f5c9290.js:41772:19)
at onwarn (D:\work\ytt-pc-1\node_modules\vite\dist\node\chunks\dep-8f5c9290.js:41588:13)
at Object.onwarn (D:\work\ytt-pc-1\node_modules\rollup\dist\shared\rollup.js:23224:13)
at ModuleLoader.handleResolveId (D:\work\ytt-pc-1\node_modules\rollup\dist\shared\rollup.js:22508:26)
at ModuleLoader.resolveDynamicImport (D:\work\ytt-pc-1\node_modules\rollup\dist\shared\rollup.js:22560:120)
at D:\work\ytt-pc-1\node_modules\rollup\dist\shared\rollup.js:22455:32
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
我需要在vite-vue的项目上实现 import( / webpackChunkname: "xxx" / ) 的效果手动设置模块的chunkname,我已经在网上找到了解决方案并且fork了一份现在增加了json文件支持功能,但是我发现这个方案无法用在node_modules内的文件上。
https://github.com/thetime50/...
出错的点是node_modules的文件带'?'的引入方式,而插件处理过程中会在transform里会把 import( / webpackChunkname: "xxx" 'vue3-lottie'/ )代码转换为import( 'vue3-lottie?chunkName=xxx' */ )
我建了一个测试项目
https://github.com/thetime50/...
如果我把node_modules@time50\vite-plugin-webpackchunkname\src\index.ts目录下载的&& !nodeModuleIdSets.has(id)删除掉,在插件目录下执行npm run build。然后在项目目录下执行npm run build时就会有这样的报错
我不知道现在该怎么处理可以让chunkname插件能够支持node_nodules里的文件
Beta Was this translation helpful? Give feedback.
All reactions