Solid Start Vinxi complaining about public and can't resolve public fonts
When I define my font faces and reference the actual font files like so:
It does not complain but when building it will state it can't resolve it.
If I do:
It will resolve but complain endlessly when doing a dev server
I used Astro with the root and had no issues
What am I doing wrong?
5 Replies
- Created and installed fresh SolidStart(TS) "basic" project.
- moved
src/app.css
to src/styles/app.css
- adjusted import './styles/app.css';
in src/app.tsx
- copied Geist-SemiBold.woff2
into public/fonts
- modified src/styles/app.css
:
- $ pnpm run dev
and visit http://localhost:3000/
. It works.
- $ pnpm run build
. You'll see a bunch of
-/fonts/Geist-SemiBold.woff2
referenced in/fonts/Geist-SemiBold.woff2
didn't resolve at build time, it will remain unchanged to be resolved at runtime
$ node .output/server/index.mjs
and visit http://localhost:3000/
. It works./fonts/Geist-SemiBold.woff2 referenced in /fonts/Geist-SemiBold.woff2 didn't resolve at build time, it will remain unchanged to be resolved at runtime
yeah this is my issue
does it not matter?Given that font files are not bundled, no. What's important is that they can be located at runtime.
You can use
preload
to give the browser a hint that it will need the font files.MDN Web Docs
rel=preload - HTML: HyperText Markup Language | MDN
The preload value of the element's rel attribute lets you declare fetch requests in the
HTML's , specifying resources that your page will need very soon, which you want to start loading early in the page lifecycle,
before browsers' main rendering machinery kicks in. This ensures they are available earlier and are less likely to block the page's...
You can suppress the message with this
app.config.ts
:
https://rollupjs.org/configuration-options/#external
That way it will only complain about files you haven't added yet (warning you of potential misspellings).Rollup
The JavaScript module bundler
Thank you
I appreciate the clarifications and support