Optimized dependency error
See original GitHub issueDo NOT ignore this template or your issue will have a very high chance to be closed without comment.
Describe the bug
When I added ant-design-vue
, an error occurred.
Dep optimization failed with error:
[vite]: Rollup failed to resolve import "indexof" from "indexof?commonjs-external".
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
`rollupInputOptions.external`
(node:28953) UnhandledPromiseRejectionWarning: Error: [vite]: Rollup failed to resolve import "indexof" from "indexof?commonjs-external".
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
`rollupInputOptions.external`
I tried adding indexof
to rollupInputOptions.external
, but this did not work.
At the same time, the project has another error.
import Ant from 'ant-design-vue';
import 'ant-design-vue/dist/antd.css'
When the following two sentences are introduced at the same time, vite will prompt to add ant-design-vue/dist/antd.css
to optimizeDeps.include
. But after I added it, an error was reported, and the error message is as follows
Dep optimization failed with error:
Entry module cannot be external (node_modules/ant-design-vue/dist/antd.css).
Reproduction
- clone https://github.com/anncwb/vite-bug
- yarn serve
System Info
- required
vite
version: - required Operating System:
- required Node version:
- Optional:
- npm/yarn version
- Installed
vue
version (fromyarn.lock
orpackage-lock.json
) - Installed
@vue/compiler-sfc
version
Logs (Optional if provided reproduction)
- Run
vite
orvite build
with the--debug
flag. - Provide the error log here.
Issue Analytics
- State:
- Created 3 years ago
- Comments:7
Top Results From Across the Web
Dependencies error while trying to use country selector in my ...
After I install it in my ubuntu, and I am trying to run the code however I am getting this error : [ERROR]...
Read more >Dependency optimization - CloudBees Documentation
When dependency optimization is enabled, eMake maintains a dependency information file for each makefile. If a build's dependencies have not changed from ...
Read more >Dependency Resolution Optimization - ActiveState's Approach
Dependency resolution is at the core of the ActiveState Platform. When you create a project and start adding requirements, we tell you what ......
Read more >Dependency Injection Not Wiring Up Properly When Optimize ...
I debugged locally and strangely when my Web project is optimized, the DLL that is passed to the AddMvcControllers method is Sitecore.Kernel ...
Read more >Dependency of optimization error of Algorithm 1 on iteration
Download scientific diagram | Dependency of optimization error of Algorithm 1 on iteration from publication: Improved Exploiting Higher Order Smoothness in ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@yyx990803 60a4708 好像只是把报错改成了报警,真正导致错误的原因似乎是 ant-design-vue 引用了
indexof
而 rollup 处理失败了Hi @anncwb
I just ran into this problem too. I fixed it (surprisingly) by adding a leading slash to the file path.
e.g. change
import 'ant-design-vue/dist/antd.css'
toimport '/ant-design-vue/dist/antd.css'
Hopefully, it will help you.