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

esbuild crashes when style.css contains @font-face definitions #786

Open
Fil opened this issue Feb 14, 2024 · 3 comments · May be fixed by #1372
Open

esbuild crashes when style.css contains @font-face definitions #786

Fil opened this issue Feb 14, 2024 · 3 comments · May be fixed by #1372
Assignees
Labels
bug Something isn’t working

Comments

@Fil
Copy link
Contributor

Fil commented Feb 14, 2024

following https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face I create a style.css file with:

@font-face {
  font-family: "Trickster";
  src:
    local("Trickster"),
    url("trickster-COLRv1.otf") format("opentype") tech(color-COLRv1),
    url("trickster-outline.otf") format("opentype"),
    url("trickster-outline.woff") format("woff");
}

the css bundling crashes with recommendations to "mark paths as external" (unhelpful, since this is commandeered by framework, not by the user), reference:

style docs/style.css → ✘ [ERROR] Could not resolve "trickster-COLRv1.otf"

    docs/style.css:5:8:
      5 │     url("trickster-COLRv1.otf") format("opentype") tech(color-COLRv1),
        ╵         ~~~~~~~~~~~~~~~~~~~~~~

  You can mark the path "trickster-COLRv1.otf" as external to exclude it from
  the bundle, which will remove this error and leave the unresolved path in the
  bundle.

✘ [ERROR] Could not resolve "trickster-outline.otf"

    docs/style.css:6:8:
      6 │     url("trickster-outline.otf") format("opentype"),
        ╵         ~~~~~~~~~~~~~~~~~~~~~~~

  You can mark the path "trickster-outline.otf" as external to exclude it from
  the bundle, which will remove this error and leave the unresolved path in the
  bundle.

✘ [ERROR] Could not resolve "trickster-outline.woff"

    docs/style.css:7:8:
      7 │     url("trickster-outline.woff") format("woff");
        ╵         ~~~~~~~~~~~~~~~~~~~~~~~~

  You can mark the path "trickster-outline.woff" as external to exclude it from
  the bundle, which will remove this error and leave the unresolved path in the
  bundle.


Unexpected error: Build failed with 3 errors:
docs/style.css:5:8: ERROR: Could not resolve "trickster-COLRv1.otf"
docs/style.css:6:8: ERROR: Could not resolve "trickster-outline.otf"
docs/style.css:7:8: ERROR: Could not resolve "trickster-outline.woff"

@Fil Fil added the bug Something isn’t working label Feb 14, 2024
@Fil

This comment was marked as outdated.

@Fil
Copy link
Contributor Author

Fil commented Feb 14, 2024

While I'm in this section… shouldn't we minify on build? → this point is discussed in #787

Fil added a commit that referenced this issue Feb 14, 2024
@mbostock
Copy link
Member

mbostock commented Apr 22, 2024

Ref. esbuild’s on-resolve callback: https://esbuild.github.io/plugins/#on-resolve

@Fil Fil self-assigned this May 20, 2024
Fil added a commit that referenced this issue May 20, 2024
(This includes images and fonts using url().)

Using onResolve (as suggested in #786 (comment))

closes #786
supersedes #788
@Fil Fil linked a pull request May 20, 2024 that will close this issue
2 tasks
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
2 participants