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

[Bug]: 使用rsbuild创建 [email protected]时使用 source.transformImport 配置按需加载报错 #2014

Closed
wang-yi-bit64 opened this issue Apr 7, 2024 · 3 comments
Assignees
Labels
🐞 bug Something isn't working

Comments

@wang-yi-bit64
Copy link

Version

系统:win11
浏览器:Edge
{
  "name": "test-antdless",
  "private": true,
  "version": "1.0.0",
  "scripts": {
    "dev": "rsbuild dev --open",
    "build": "rsbuild build",
    "preview": "rsbuild preview"
  },
  "dependencies": {
    "react": "^16.2.0",
    "react-dom": "^16.2.0",
    "@ant-design/icons": "1.0.0",
    "antd": "4.24.15"
  },
  "devDependencies": {
    "@rsbuild/core": "^0.5.7",
    "@rsbuild/plugin-react": "^0.5.7"
  }
}

Details

运行的dev的时候报错
Failed to compile, check the errors for troubleshooting.
File: ./node_modules/antd/es/style/default.less
× Module build failed:
╰─▶ ×
│ SyntaxError

│ (43:16) D:\work-code\Vite\jsTest\test-antdless\node_modules\antd\es\style\default.less Double colon

│ 41 | color: #666;
│ 42 | font-size: 14px;
│ > 43 | font-family: : "Hiragino Sans GB", Helvetica, "sans-serif";
│ | ^
│ 44 | font-variant: tabular-nums;
│ 45 | line-height: 1.5715;

help: File was processed with this loader: 'D:\work-code\Vite\jsTest\test-antdless\node_modules@rsbuild\shared\compiled\postcss-loader\index.js??ruleSet[1].rules[10].oneOf[1].use[0]$D:\work-
code\Vite\jsTest\test-antdless\node_modules@rsbuild\shared\compiled\less-loader\index.js??ruleSet[1].rules[10].oneOf[1].use[1]'

Reproduce link

[email protected]:wang-yi-bit64/rsbuild-testantd4.git

Reproduce Steps

dev 报错
运行的dev的时候报错
Failed to compile, check the errors for troubleshooting.
File: ./node_modules/antd/es/style/default.less
× Module build failed:
╰─▶ ×
│ SyntaxError

│ (43:16) D:\work-code\Vite\jsTest\test-antdless\node_modules\antd\es\style\default.less Double colon

│ 41 | color: #666;
│ 42 | font-size: 14px;
│ > 43 | font-family: : "Hiragino Sans GB", Helvetica, "sans-serif";
│ | ^
│ 44 | font-variant: tabular-nums;
│ 45 | line-height: 1.5715;

help: File was processed with this loader: 'D:\work-code\Vite\jsTest\test-antdless\node_modules@rsbuild\shared\compiled\postcss-loader\index.js??ruleSet[1].rules[10].oneOf[1].use[0]$D:\work-
code\Vite\jsTest\test-antdless\node_modules@rsbuild\shared\compiled\less-loader\index.js??ruleSet[1].rules[10].oneOf[1].use[1]'

@wang-yi-bit64 wang-yi-bit64 added the 🐞 bug Something isn't working label Apr 7, 2024
@wang-yi-bit64
Copy link
Author

补充说明:
把 rsbuild.config.mjs下的 tools.less.lessOptions.modifyVars下的 @font-family配置删除后就不报错了

@9aoy
Copy link
Collaborator

9aoy commented Apr 8, 2024

image image

@wang-yi-bit64 The key should be font-family not font-family: 😂

@wang-yi-bit64
Copy link
Author

image image
@wang-yi-bit64 The key should be font-family not font-family: 😂
😂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐞 bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants