neutrinojs / neutrino

Create and build modern JavaScript projects with zero initial configuration.
https://neutrinojs.org
Mozilla Public License 2.0
3.95k stars 214 forks source link

OTF fonts not supported by font-loader middleware #1662

Closed aratcliffe closed 3 years ago

aratcliffe commented 3 years ago

I'm importing a library which uses OTF fonts. These cannot be loaded by the font-loader middleware. Could support for this format be added? In the meantime is it possible to configure the middleware to support this format? I couldn't figure out how to do that.

constgen commented 3 years ago

Until this issue is fixed, you can use this local workaround

.neutrinorc.js

module.exports = {
  use: [
    // ... your presets here
    function(neutrino){
      neutrino.config.module.rule('font').test(/\.(eot|otf|ttf|woff|woff2)(\?v=\d+\.\d+\.\d+)?$/)
    }
  ]
}

This will modify extensions for the font loader

aratcliffe commented 3 years ago

Thank you @constgen. That works perfectly!

constgen commented 3 years ago

Lets keep it open. We will fix it in the core