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] umi3升级到umi4后,css中无法直接使用/来使用public目录下的图片 #9944

Closed
fanmingfei opened this issue Jun 23, 2022 · 0 comments

Comments

@fanmingfei
Copy link

fanmingfei commented Jun 23, 2022

🐛 bug 描述

error - ./src/pages/index.less.webpack[javascript/auto]!=!./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[5].oneOf[0].use[1]!./node_modules/@umijs/bundler-webpack/compiled/postcss-loader/index.js??ruleSet[1].rules[5].oneOf[0].use[2]!./node_modules/@umijs/bundler-webpack/compiled/less-loader/index.js??ruleSet[1].rules[5].oneOf[0].use[3]!./src/pages/Welcome.less?modules:6:36-73
Module not found: Error: Can't resolve '/logo.svg' in '/work/src/pages'

📷 复现步骤

在css中使用
background:url('/xxxx.png')

🏞 期望结果

与umi3效果相同

💻 复现代码

https://codesandbox.io/s/priceless-haze-ec8rjc?file=/src/pages/Home/index.less

© 版本信息

  • Ant Design 版本: 4.21.3
  • umi 版本 4.0.0
  • 浏览器环境 Chrome
  • 开发环境 MacOS

🚑 其他信息

image

@fanmingfei fanmingfei changed the title 🐛[BUG] 使用umi3和umi4,css中无法直接使用/public 🐛[BUG] 使用umi3和umi4,css中无法直接使用/来使用public目录下的图片 Jun 23, 2022
@fanmingfei fanmingfei changed the title 🐛[BUG] 使用umi3和umi4,css中无法直接使用/来使用public目录下的图片 🐛[BUG] umi3升级到umi4后,css中无法直接使用/来使用public目录下的图片 Jun 23, 2022
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

2 participants