We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
System: OS: Windows 10 10.0.19045 CPU: (16) x64 11th Gen Intel(R) Core(TM) i7-11850H @ 2.50GHz Memory: 2.82 GB / 31.67 GB Browsers: Edge: Chromium (127.0.2651.86) Internet Explorer: 11.0.19041.4355
I have a CSS file with my local font
@font-face { font-family: 'Gilroy'; font-style: normal; font-weight: 300; src: url('../assets/fonts/Gilroy-Light.otf'); }
When I build it, I get the error
File: C:\xxx\packages\ui\dist\context\context.css:1:1 × Module not found: Can't resolve '/static/font/Gilroy-Light.otf' in 'C:\xxx\packages\ui\dist\context' ╭─[5:36] 3 │ import ___CSS_LOADER_API_IMPORT___ from "../../../../node_modules/@rsbuild/core/compiled/css-loader/api.js"; 4 │ import ___CSS_LOADER_GET_URL_IMPORT___ from "../../../../node_modules/@rsbuild/core/compiled/css-loader/getUrl.js"; 5 │ var ___CSS_LOADER_URL_IMPORT_0___ = new URL("/static/font/Gilroy-Light.otf", import.meta.url); ╰────
If I check the built CSS in the dist folder, it changes the file to
@font-face { font-family: Gilroy; font-style: normal; font-weight: 300; src: url(/static/font/Gilroy-Light.otf); }
If I manually change the src to
src: URL(../static/font/Gilroy-Light.otf);
then it works. I also tried to use
tools: { cssLoader: { url: false, }, },
but then the fonts are not exported.
I tried an example using codesandbox and in this example, only by using URL(...) I got an error:
error Compile error: Failed to compile, check the errors for troubleshooting. File: /project/workspace/packages/ui/src/styles/fonts.css?__rslib_entry__:1:1 × Module build failed: ╰─▶ × TypeError: Cannot read properties of undefined (reading '__esModule') │ at handleExports (file:///project/workspace/node_modules/.pnpm/@[email protected][email protected]/node_modules/@rslib/core/dist/libCssExtractLoader.js:34:45) │ at file:///project/workspace/node_modules/.pnpm/@[email protected][email protected]/node_modules/@rslib/core/dist/libCssExtractLoader.js:121:9 │ at /project/workspace/node_modules/.pnpm/@[email protected]_@[email protected]/node_modules/@rspack/core/dist/index.js:6301:13
if I try url: false it builds fine but the font file is not exported.
url: false
https://codesandbox.io/p/devbox/sx9t7q
You'll see the error already
The text was updated successfully, but these errors were encountered:
It has been fixed by #573 and released in v0.1.5. You can update @rslib/core to latest version.
v0.1.5
@rslib/core
Sorry, something went wrong.
No branches or pull requests
Version
Details
I have a CSS file with my local font
When I build it, I get the error
If I check the built CSS in the dist folder, it changes the file to
If I manually change the src to
then it works.
I also tried to use
but then the fonts are not exported.
I tried an example using codesandbox and in this example, only by using URL(...) I got an error:
if I try
url: false
it builds fine but the font file is not exported.Reproduce link
https://codesandbox.io/p/devbox/sx9t7q
Reproduce Steps
You'll see the error already
The text was updated successfully, but these errors were encountered: