umijs / umi

A framework in react community ✨
https://umijs.org
MIT License
15.25k stars 2.65k forks source link

[Bug] monorepo formily less resolver error #10263

Closed nfwyst closed 1 year ago

nfwyst commented 1 year ago
截屏2023-01-10 18 58 14

找不到样式文件

github-actions[bot] commented 1 year ago

由于缺乏足够的信息,我们暂时关闭了该 Issue。请修改(不要回复) Issue 提供最小重现以重新开启。谢谢。

fz6m commented 1 year ago

给一个最小复现看看

dayuy commented 1 year ago

给一个最小复现看看

@fz6m

项目的less文件中使用 "~antd/...": @import '~antd/lib/modal/style/index.less; 会出现报错信息: Webpack resolver error details: resolve '~antd/lib/modal/style/index.less' in 'work/console/src' Parsed request is a module using description file: work/console/package.json (relative path: ./src) using description file: work/console/package.json (relative path: ./src/~antd/lib/modal/style/index.less) no extension work/console/src/~antd/lib/modal/style/index.less doesn't exist .less work/console/src/~antd/lib/modal/style/index.less.less doesn't exist .css work/console/src/~antd/lib/modal/style/index.less.css doesn't exist as directory work/console/src/~antd/lib/modal/style/index.less doesn't exist resolve as module 依赖版本: @umijs/max@4.0.47 @umijs/bundler-webpack@4.0.47

xiaohuoni commented 1 year ago

antd 版本是 5.x 吧?

fz6m commented 1 year ago

antd 5 的话,升级一下最新版本的 umi 依赖看一下,在 antd 5 中是 css in js 生成样式,无需手动导入任何 antd 样式,css 和 ts 中写的 antd style import 都可以去掉。

nfwyst commented 1 year ago

antd 5 的话,升级一下最新版本的 umi 依赖看一下,在 antd 5 中是 css in js 生成样式,无需手动导入任何 antd 样式,css 和 ts 中写的 antd style import 都可以去掉。

@formily/antd 这个 package 中使用了 import 的方式

fz6m commented 1 year ago

那就降级项目中的 antd 依赖版本到 4 ,全局只有唯一的 antd 。