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

No loader is defined for .ttf files #184

Open
mckravchyk opened this issue Jul 9, 2024 · 1 comment
Open

No loader is defined for .ttf files #184

mckravchyk opened this issue Jul 9, 2024 · 1 comment

Comments

@mckravchyk
Copy link

mckravchyk commented Jul 9, 2024

I have a font-face definition

@font-face {
  font-family: 'NotoSans';
  font-style: normal;
  font-weight: 400;
  src: url('../assets/fonts/NotoSans400.ttf') format('truetype');
}

It looks like it's trying to resolve it, giving an error: "No loader is defined for .ttf files" Obviously, I do not want to load those files into the bundle, but rather pass the url statement to the output CSS. Is there a way to make this work? Thanks!

@dungjk
Copy link
Contributor

dungjk commented Oct 14, 2024

Hello @mckravchyk
Sorry for late reply, but hope this will help.
Esbuild try to resolve many thing import from input entry. In you case, to resolve you can follow document from esbuild.

eg:

import { build } from 'esbuild';

build({
   // You options here
  loader: {
    '.ttf': 'copy' // This loader will copy the file to the output directory and rewrite the import path to point to the copied file.  
                    // You should read the document to get more loader options.
  }
});

Best regards

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants