-
-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Dep optimization failed with vite2.0 #3481
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
Comments
// vite.config.ts
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
export default defineConfig({
plugins: [vue()],
optimizeDeps: {
exclude: ['ant-design-vue', 'lodash']
}
}) |
这并不能解决任何问题 |
I think This issue should be referred to the Vite team。 |
Ant Design Vue 有几个很有问题的依赖,建议仔细捋一遍依赖,尽量不要再依赖 CommonJS 格式的。 |
@tangjinzhou 按照尤大的建议,我捋了一遍,看看能不能帮到。如果还没人来解决,我可以解决一部分。但是很多还是要你们来处理。 整理如下 可以移动到devDependencies的包有
没用到的依赖有
一些建议的包
引用了 commonjs的包
|
@chad-bin 大佬,你好。 我用 antd-mobile 里也有 component-classes 内部 require('indexof') 和require('component-indexof') 这个,导致打包后的文件里有 import 'indexof' 从而访问报错,请问有什么办法解决呢? |
这个问题有任何进展吗? |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Version
2.0.0-rc.7
Environment
vue: 3.0.5, vite: 2.0.0-beta.4
Reproduction link
https://github.com/Hawods/antd-vite2-test
Steps to reproduce
yarn
)yarn dev
)What is expected?
Dev server started
What is actually happening?
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
build.rollupOptions.external
The text was updated successfully, but these errors were encountered: