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

Can't bundle woff files #239

Closed
janat08 opened this issue Nov 15, 2023 · 10 comments
Closed

Can't bundle woff files #239

janat08 opened this issue Nov 15, 2023 · 10 comments
Assignees
Labels
bug Something isn't working

Comments

@janat08
Copy link

janat08 commented Nov 15, 2023

I tried rollup, parcel, and esbuild. None of them support woff imports by default. It'd be nice for install instructions to include the workaround necessary to get beercss bundled, or provide alternate install way that has woff files just linked in html.

@parcel/core: No transformers found for
node_modules/beercss/dist/cdn/material-symbols-sharp.woff2.

@leonardorafael leonardorafael self-assigned this Nov 16, 2023
@leonardorafael leonardorafael added the bug Something isn't working label Nov 16, 2023
@leonardorafael
Copy link
Collaborator

leonardorafael commented Nov 16, 2023

Fixed in v3.4.6 (https://github.com/beercss/beercss/releases/tag/v3.4.3)

You don't need to import fonts anymore, bundlers will do it automatically (updated README.md).

image

@janat08
Copy link
Author

janat08 commented Nov 29, 2023

esbuild --bundle --minify --outfile=src/assets/static/jsLibsClient.js ./src/jsLibsClient.js

X [ERROR] No loader is configured for ".woff2" files: node_modules/beercss/dist/cdn/material-symbols-sharp.woff2

import "beercss/dist/cdn/beer.min.css";
import beercss from "beercss/dist/cdn/beer.min.js";

@myrp-leonardo
Copy link
Contributor

myrp-leonardo commented Nov 29, 2023

Have you tried the latest version v3.4.7? It will not import the .woff2 files anymore.

@janat08
Copy link
Author

janat08 commented Nov 29, 2023 via email

@myrp-leonardo
Copy link
Contributor

myrp-leonardo commented Nov 29, 2023

@janat08 here it works https://codesandbox.io/p/devbox/lucid-rain-4gxknv (using parcel 2)

@janat08
Copy link
Author

janat08 commented Nov 30, 2023 via email

@janat08
Copy link
Author

janat08 commented Dec 1, 2023

No reason that esbuild shouldn't work over not knowing what to do with woff files?

@TorH2k3
Copy link

TorH2k3 commented Jan 4, 2024

I don't get why this bug has been closed, I'm using the latest versions of beercss and material-dynamic-colors and still get the error "No loader is configured for ".woff2"" when building.
"beercss": "^3.4.7"
"material-dynamic-colors": "^1.1.0"

X [ERROR] No loader is configured for ".woff2" files: node_modules/beercss/dist/cdn/material-symbols-rounded.woff2

node_modules/beercss/dist/cdn/beer.min.css:1:2874:
  1 │ ...splay:swap;src:url(material-symbols-rounded.woff2) format("woff2...
    ╵                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

@leonardorafael
Copy link
Collaborator

leonardorafael commented Jan 4, 2024

Hi, this issue was closed because this is not a bug in Beer CSS itself (after v3.4.6 when we removed the import woff files directly). Load font files inside CSS is a web standard. It seems that the bundler need some extra plugin/config to do the job. In my opinion, all bundlers should have to follow the web standards by default.

I found a possible solution here (making .woff and .woff2 files as external)?
evanw/esbuild#800

Let me know if this works for you, please.

@tmutton
Copy link

tmutton commented Apr 28, 2024

If, like me, you've suffered the same problem; please read this angular cli PR - angular/angular-cli#26371 which was released as part of the 17.1.0 version.

The fix for this problem is to add the following option in your angular.json file

"loader": {
              ".woff2": "file"
            }

This should sit under architect > build > options

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

5 participants