storybook icon indicating copy to clipboard operation
storybook copied to clipboard

The "_fonts" folder is not being created (@nuxt/fonts)

Open musicraccoon opened this issue 1 year ago • 6 comments

Environment



Reproduction

Describe the bug

When using the "@nuxt/fonts" module, the "_fonts" folder is not created in "storybook-static" If you run "nuxt build", then everything works

Additional context

No response

musicraccoon avatar Dec 07 '24 13:12 musicraccoon

I've found the cause of the issue and included a temporary workaround in https://github.com/nuxt/fonts/issues/500

lukereative avatar Feb 13 '25 01:02 lukereative

Look like this was fixed in v0.11.3 of the @nuxt/fonts module: https://github.com/nuxt/fonts/releases/tag/v0.11.3

I believe we can close this issue 👍

hacknug avatar Jul 09 '25 11:07 hacknug

Thanks! It would be nice to have a test story in the showcase example for the font module.

tobiasdiez avatar Jul 09 '25 13:07 tobiasdiez

Thanks! It would be nice to have a test story in the showcase example for the font module.

I'll try to open a PR tomorrow 👌

hacknug avatar Jul 09 '25 18:07 hacknug

I have bad news 🤦‍♂️

The fonts module seems to work fine when browsing the site during development (I added a /modules/fonts route to see the demo component in action).

It does not seem to work inside Storybook though. I see the font-family being transformed so I'm guessing the issue is either we don't load the css produced by the module or the /_fonts dir is still not being loaded.

You can see the changes on #921.

hacknug avatar Jul 10 '25 10:07 hacknug

The /_fonts dir is right there, we just need to proxy it so it's accessible from storybook's port. PR has been updated with the change.

@musicraccoon try adding a proxy yourself to viteFinal if you need this to work before the fix is released:

  async viteFinal(config) {
    if (config.server?.proxy) {
      config.server.proxy['/_fonts'] = {
        target: 'http://localhost:3000',
        changeOrigin: true,
        secure: false,
      }
    }
    return config
  },

Something like this should work although I haven't tried it myself 🙏

hacknug avatar Oct 07 '25 16:10 hacknug