Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

下拉菜单 Dropdown只要使用了a-dsubmenu多级菜单,打包时就报错 #2043

Closed
1 task
zhonghuaifang opened this issue Jan 12, 2023 · 8 comments
Closed
1 task

Comments

@zhonghuaifang
Copy link

基本信息

  • 依赖包名 及 版本: @arco-design/web-vue@2.41.1
  • 框架版本: Vue3
  • 浏览器版本: chrome108.0.0.0

额外补充

错误信息:
[vite]: Rollup failed to resolve import "D:/www/data_pool/node_modules/@arco-design/web-vue/es/dsubmenu/style/css.js" from "src/views/data-center/metrics-database/components/content-chart-metrics/chart-series-source-box.vue?vue&type=script&setup=true&lang.ts".
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 "D:/www/data_pool/node_modules/@arco-design/web-vue/es/dsubmenu/style/css.js" from "src/views/data-center/metrics-database/components/content-chart-metrics/chart-series-source-box.vue?vue&type=script&setup=true&lang.ts".
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 (file:///D:/www/data_pool/node_modules/vite/dist/node/chunks/dep-4da11a5e.js:45916:19)
at onwarn (file:///D:/www/data_pool/node_modules/vite/dist/node/chunks/dep-4da11a5e.js:45714:13)
at Object.onwarn (file:///D:/www/data_pool/node_modules/rollup/dist/es/shared/rollup.js:23263:13)
at ModuleLoader.handleResolveId (file:///D:/www/data_pool/node_modules/rollup/dist/es/shared/rollup.js:22158:26)
at file:///D:/www/data_pool/node_modules/rollup/dist/es/shared/rollup.js:22119:26
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

@zhonghuaifang
Copy link
Author

看了一下,好像没有/node_modules/@arco-design/web-vue/es/dsubmenu这个文件夹

@Chanzhaoyu
Copy link
Contributor

是不是用了 vite-plugin-style-import 这个插件,这个插件在 vite^4.0.0 上会有点问题

@zhonghuaifang
Copy link
Author

@Chanzhaoyu
是用了vite-plugin-style-import插件,因为用的Arco Design Pro,里面自带这个插件。
有什么办法解决这个报错吗?
我目前是手动创建了dsubmenu这个文件夹,然后把dropdown文件夹里面的style文件夹复制过去,能打包,不确定有没有问题

@Chanzhaoyu
Copy link
Contributor

@zhonghuaifang
dsubmenu 这个是子组件,没有单独的文件夹样式。这个插件不维护了,你尝试下用 按需加载(模板)替换掉它吧。

@Chanzhaoyu
Copy link
Contributor

@zhonghuaifang dsubmenu 这个是子组件,没有单独的文件夹样式。这个插件不维护了,你尝试下用 按需加载(模板)替换掉它吧。

或者你把 vite 等插件降级下,arco design pro 最近有更新,就是降级了 vite

@zhonghuaifang
Copy link
Author

@Chanzhaoyu 我试试,谢谢

@zhonghuaifang
Copy link
Author

记录:

问题:升级到最新版的arco design pro还是一样打包报错
解决过程:找到/config/plugin/arcoResolver.ts文件中的说明“虽然Pro项目中是全量引入组件,但此插件会默认使用。”(unplugin-vue-components 按需引入插件)
解决方法:/config/plugin/styleImport.ts文件中,在ignoreList数组中加入dsubmenu

@lisentowind
Copy link

谢谢 已成功解决 year-picker 和 dsubmenu 打包问题

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants