I am trying to include some fonts with a component library that I will distribute as an UMD bundle generated with Webpack and installed as an NPM module; the components make use of those fonts. The problem is that URLs pointing to the fonts in the generated bundle are incorrect and result in 404s when the application that uses the library is run.
For example, resolve-url-loader
will output a URL of "/myfont.woff"
. But of course, that file is not actually available at that URL in the application unless the application that uses it does some configuration to copy that file and serve it at the expected path.
Is there a way to automatically make these fonts available (i.e., font-face: 'My Font'
will work) when an application imports a component from my library, minimizing amount of configuration needed in the application that uses it?
For large files, I don't want to use url-loader
and Base 64-encode them and I can't use a CDN.