The "_fonts" folder is not being created (@nuxt/fonts)
Environment
- Operating System: Linux
- Node Version: v20.14.0
- Nuxt Version: 3.14.159
- CLI Version: 3.16.0
- Nitro Version: 2.10.4
- Package Manager: [email protected]
- Builder: -
- User Config: default
- Runtime Modules: @nuxtjs/[email protected], @nuxt/[email protected]
- Build Modules: -
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
I've found the cause of the issue and included a temporary workaround in https://github.com/nuxt/fonts/issues/500
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 👍
Thanks! It would be nice to have a test story in the showcase example for the font module.
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 👌
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.
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 🙏