-
-
Notifications
You must be signed in to change notification settings - Fork 604
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
Font loading stopped working in 6.0.0 #1354
Comments
@mtmacdonald Glad it’s not just me! I’ve run into this on two separate projects after upgrading to v6. One is a WordPress site built on top of the Sage theme framework (v9, using Webpack). Here’s their default Webpack config: https://github.com/roots/sage/blob/a3055a4469727c2becaacbb8612f9f49d9a670ee/resources/assets/build/webpack.config.js#L62-L120 The other site is built with Eleventy, using this boilerplate’s Webpack config: FWIW after upgrading to v6, any fonts referenced via Before: @font-face {
font-family: "Zilla Slab";
font-style: normal;
font-weight: 400;
src: url("../fonts/zilla-slab/zilla-slab-regular.woff2") format("woff2"),
url("../fonts/zilla-slab/zilla-slab-regular.woff") format("woff");
} After @font-face {
font-family: "Zilla Slab";
font-style: normal;
font-weight: 400;
src: url(/assets/11cf47d98920cdfba843.woff2) format("woff2"),
url(/assets/8b7198a7b0b7f94ddc05.woff) format("woff"); } Interestingly, I tried adding |
Having exactly the same issue. Was basically loosing my mind about this |
Hi! I ran into the same problem today, but there is a solution. This information is also mentioned in the release notes for v6.0.0 (https://github.com/webpack-contrib/css-loader/releases/tag/v6.0.0) This is what I had before in my config:
This is how my new configuration looks like (and works):
Hope that helps. |
And an example that was using url-loader with custom limit: Old config:
New config:
|
Hey @MGafitescu Will try it out. Thanks for the help. |
@MGafitescu Thanks so much, that did the trick!! I’d seen the part about FYI for everyone else upgrading to v6, note that the dot is automatically included with - name: '[name].[ext]'
+ filename: '[name][ext]' |
Thanks @MGafitescu it worked 100% |
@tedw I think it wasn't in the breaking changes because you can still make them work.
To be honest, I didn't try to make it work because it's easy enough to stop using the deprecated loaders and you'd have to do it anyway in the future. |
@MGafitescu super helpful, thank you. Your resolution works. If I was using a deprecated loader and the suggestion resolves the issue (does for me), I'm fine with this ticket being closed (I'll do that now). |
For searching: OTS parsing error |
fixes icons and image issues webpack-contrib/css-loader#1354 (comment)
* update js, patch versions only * upgrade babel (minor version) * update deck.gl (minor) * upgrade core-js (minor) * upgrade eslint-plugin-import (minor) * update leaflet (minor) * upgrade mini-css-extract-plugin (minor) * upgrade sass (minor) * upgrade webpack webpack-cli (minor) * upgrade copy-webpack-plugin (major) * upgrade css-minimizer-webpack-plugin (major) * upgrade eslint (major) * upgrade eslint-config-standard (major) * upgrade eslint-plugin-promise (major) * upgrade sass-loader (major) * upgrade style-loader (major) * upgrade stylelint and stylelint-scss (major) * upgrade @fortawesome/fontawesome-free (major) * update css-loader (major) * add !optional as suggested in logs * file-loader is deprecated fixes icons and image issues webpack-contrib/css-loader#1354 (comment) * update leaflet image path * add eslint-plugin-n package * use object shorthand notation * remove console.log * install stylelint-config-standard-scss * use stylelint-config-standard-scss * update rules and scss code * correct some linting problems * add some exceptions * use only single quotes in scss * upgrade eslint (minor)
Summary: since
css-loader
6.0.0, my app no longer imports and displays web fonts correctly.Mac OS Big Sur version 11.3.1
14.15.0
6.14.8
5.47.0
6.0.0
up to6.2.0
Expected Behavior
Imported fonts load and display correctly.
Actual Behavior
Imported fonts don't display, and browsers give me these errors. In Chrome:
and Firefox:
Code
My app is an open-source repository: react-ui-library. The master branch is still using css-loader
5x
(just bump it to6x
to reproduce).I will give a summary of the code parts I think are relevant here.
src/style/fonts.less
:webpack/webpack.common.rules.less
:How Do We Reproduce?
Check out the repository master branch. Bump the
css-loader
version6x
. Thennpm install
andnpm run dev:docs
to run the app. The errors can be seen in the console.The text was updated successfully, but these errors were encountered: