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

支不支持esbuild配置项? #541

Closed
kimmy-wang opened this issue Oct 25, 2022 · 8 comments
Closed

支不支持esbuild配置项? #541

kimmy-wang opened this issue Oct 25, 2022 · 8 comments

Comments

@kimmy-wang
Copy link

支不支持esbuild配置项?

@PeachScript
Copy link
Member

不支持,要改什么配置

@kimmy-wang
Copy link
Author

开发了一个组件库,底层用到了antd 和 react,引用打包出来的组件报错。但是使用esbuild打包就正常。

截屏2022-10-25 18 10 37

@PeachScript
Copy link
Member

PeachScript commented Oct 25, 2022

如果产物是 umd、检查 externals 配置项;如果产物不是 umd、检查依赖声明有没有问题,参考:#537 (comment)

father 4 的 esbuild 只支持 bundless,暂不考虑开放配置项,应该也和你遇到的问题无关

@kimmy-wang
Copy link
Author

已经这样设置了。

@PeachScript
Copy link
Member

提供下复现仓库和步骤吧

@kimmy-wang
Copy link
Author

kimmy-wang commented Oct 26, 2022

1、克隆仓库 https://github.com/kimmy214/father-issue
2、执行,yarn
3、执行 yarn build
4、执行 yarn link

5、克隆仓库 https://github.com/kimmy214/nextjs-father-issue
6、执行,yarn
7、在dependencies中添加 "father-issue": "0.0.1-alpha.0"
8、执行 yarn link "father-issue"
9、执行 yarn dev
10、访问 http://localhost:3000/test

@kimmy-wang
Copy link
Author

@PeachScript 有任何进展吗?

@BoyYangzai
Copy link
Member

@kimmy214
1.你复现项目中antd的版本是4.x,它依赖的react是17,但是你nextjs里面需要18,版本冲突了
2.我尝试了一下 nextjs的node_modules与npmlink 相同的antd文件时,npm link的有问题报-找不到useContext,而node_modules下的正常渲染,暂时不知道你复现项目中版本有问题还是npmlink与nextjs的ssr渲染问题,好像应该是后者
3.我尝试在nextjs-father-issue用umi替换nextjs,发现达到预期效果,esm产物渲染成功

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

No branches or pull requests

3 participants