-
Notifications
You must be signed in to change notification settings - Fork 159
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]: Error when using absolute path to reference online resources (non-local resources) in css/less #1948
Labels
bug
Something isn't working
Comments
please try out / 请尝试: export default defineConfig({
// ...
source: {
// ...
alias: {
"/amcp/image/font": false,
},
},
// ...
}); |
the same as u |
@xc2 可以协助看下这个问题吗 |
用 externals 也可以避免 resolve 这个模块,比如: export default defineConfig({
output: {
externals: [/\/image\/font/g],
},
}); |
但有个疑问,为何mac 没问题,win有问题。 |
通常是路径分隔符的问题,Mac 和 Windows 采用了不同的路径分隔符 |
请问下,rsbuild 可以解决这个问题吗,不需要额外的配置(例如无额外配置,mac可以正常build) |
目前来说不会解决,这个路径会触发 webpack / Rspack 的 resolve 逻辑,在 create-react-app 中也能复现该问题 |
2 tasks
chenjiahan
changed the title
[Bug]: css/less中使用绝对路径引用线上资源(非本地资源)报错
[Bug]: Error when using absolute path to reference online resources (non-local resources) in css/less
Oct 24, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Version
Details
@font-face { font-family: DingTalk; src: url('/amcp/image/font/DingTalkJinBuTi.ttf'); }
报错信息
`
error Compile error:
Failed to compile, check the errors for troubleshooting.
File: ./src/routes/InvestmentCalendar/components/index.less
× Resolve error: Can't resolve '/amcp/image/font/DingTalkJinBuTi.ttf' in '/Users/tiannengyu/private/gitlab2/zgzx-trade-manager-front/src/routes/InvestmentCalendar/components'
╭─[1:1]
1 │ @font-face{
2 │ font-family: DingTalk;
3 │ src: url(/amcp/image/font/DingTalkJinBuTi.ttf);
· ─────────────────────────────────────────
4 │ }
5 │ .src-routes-InvestmentCalendar-components-index__calendar_common-_9cab1__zgtz {
╰────
start Compiling...
`
构建时报错,在css和less中使用如上方式,src :url('线上资源绝对路径')会报错
Reproduce link
/
Reproduce Steps
/
The text was updated successfully, but these errors were encountered: