-
-
Notifications
You must be signed in to change notification settings - Fork 3.8k
在 nuxt3 中使用 a-form-item, build 后运行, 报错 Cannot find module '/lodash-es/cloneDeep' #6711
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
??? |
我来看一下 |
@freedrifter ok,我知道你要怎么做了 我们推荐使用 @ant-design-vue/nuxt 来支持按需引入组件,以对服务端渲染更好的支持 export default defineNuxtConfig({
devtools: { enabled: true },
imports: {
dirs: ['./utils']
},
modules: [
'@ant-design-vue/nuxt'
],
}) 不再使用 unplugin-vue-components |
@CCherry07 |
antdv3,也是支持的,已经有pr在处理antdv4这个问题 |
This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days |
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
3.2.20
Environment
mac v12.6.3、node v18.15.0、Chrome v100
Reproduction link
https://github.com/FreeDrifter/issues/tree/main/antd-nuxt3
Steps to reproduce
What is expected?
build 后, 启动页面, 服务器渲染不报错, 无问题
What is actually happening?
报错如下:
[nuxt] [request error] [unhandled] [500] Cannot find module '/Users/xxxx/test/.output/server/node_modules/lodash-es/cloneDeep' imported from /Users/xxxx/test/.output/server/chunks/app/server.mjs
Did you mean to import lodash-es/cloneDeep.js?
at new NodeError (node:internal/errors:399:5)
at finalizeResolution (node:internal/modules/esm/resolve:326:11)
at moduleResolve (node:internal/modules/esm/resolve:945:10)
at defaultResolve (node:internal/modules/esm/resolve:1153:11)
at nextResolve (node:internal/modules/esm/loader:163:28)
at ESMLoader.resolve (node:internal/modules/esm/loader:838:30)
at ESMLoader.getModuleJob (node:internal/modules/esm/loader:424:18)
at ModuleWrap. (node:internal/modules/esm/module_job:77:40)
at link (node:internal/modules/esm/module_job:76:36)
ant-design-vue FormItem 代码:
链接: https://github.com/vueComponent/ant-design-vue/blob/main/components/form/FormItem.tsx
相关代码: import cloneDeep from 'lodash-es/cloneDeep';
但 node.js 不支持不带后缀的引入, 且 lodash-es 库的 package.json 中未定义 exports
猜测, 代码应修改为 import { cloneDeep } from 'lodash-es'
The text was updated successfully, but these errors were encountered: