Drop provider none, it disabled local icon resolution during prerender too
Trigger container build / trigger (push) Successful in 5s
Trigger container build / trigger (push) Successful in 5s
This commit is contained in:
+26
-23
@@ -137,12 +137,17 @@ export default defineNuxtConfig({
|
|||||||
// files, no Nitro server at runtime), so the `/api/_nuxt_icon` route
|
// files, no Nitro server at runtime), so the `/api/_nuxt_icon` route
|
||||||
// Nuxt Icon's client falls back to for anything not in clientBundle
|
// Nuxt Icon's client falls back to for anything not in clientBundle
|
||||||
// doesn't exist in production: that fallback goes straight to the live
|
// doesn't exist in production: that fallback goes straight to the live
|
||||||
// Iconify API instead, which the CSP's connect-src blocks. `provider:
|
// Iconify API instead, which the CSP's connect-src blocks.
|
||||||
// 'none'` plus `fallbackToApi: false` removes that live-API fallback
|
// `provider: 'none'` looked like the right fix (it's Nuxt Icon's own
|
||||||
// path entirely (both server- and client-side) rather than relying on
|
// documented recommendation for static sites) but it turned out to
|
||||||
// clientBundle/serverBundle being perfectly exhaustive to avoid ever
|
// disable dynamic icon resolution altogether, including the local
|
||||||
// triggering it, per Nuxt Icon's own recommended static-site config.
|
// serverBundle lookup during prerendering itself, not just the live-API
|
||||||
provider: 'none',
|
// fallback: every vscode-icons file-type icon (resolved dynamically by
|
||||||
|
// extension, not as a literal string) started failing to load with a
|
||||||
|
// build-time warning instead of rendering from the bundle like before.
|
||||||
|
// `fallbackToApi: false` alone gets the one thing that actually
|
||||||
|
// matters, no code path is left that can ever reach the live API,
|
||||||
|
// without taking the local resolution mechanism down with it.
|
||||||
fallbackToApi: false,
|
fallbackToApi: false,
|
||||||
customCollections: [
|
customCollections: [
|
||||||
{
|
{
|
||||||
@@ -154,9 +159,9 @@ export default defineNuxtConfig({
|
|||||||
// dynamically (not as a literal `i-xxx` string anywhere), and
|
// dynamically (not as a literal `i-xxx` string anywhere), and
|
||||||
// FileTreeNode.vue resolves vscode-icons file-type icons the same way,
|
// FileTreeNode.vue resolves vscode-icons file-type icons the same way,
|
||||||
// so Nuxt Icon's static scanner can't pick any of them up for the local
|
// so Nuxt Icon's static scanner can't pick any of them up for the local
|
||||||
// bundle. Without this, they'd need the live-API fallback above just
|
// bundle. Without this, they'd hit the now-disabled live-API fallback
|
||||||
// disabled, which is now blocked instead of avoided. Bundling all
|
// above during prerender and log a build warning instead of rendering.
|
||||||
// three collections in full sidesteps that.
|
// Bundling all three collections in full sidesteps that.
|
||||||
// Everything else used as a literal icon in content/*.md or
|
// Everything else used as a literal icon in content/*.md or
|
||||||
// .navigation.yml is added by scanContentIcons() above, so a new
|
// .navigation.yml is added by scanContentIcons() above, so a new
|
||||||
// collection introduced in an article gets bundled automatically
|
// collection introduced in an article gets bundled automatically
|
||||||
@@ -165,20 +170,18 @@ export default defineNuxtConfig({
|
|||||||
collections: [...new Set(['simple-icons', 'lucide', 'vscode-icons', ...contentIcons.collections])],
|
collections: [...new Set(['simple-icons', 'lucide', 'vscode-icons', ...contentIcons.collections])],
|
||||||
},
|
},
|
||||||
// The codeIcon values above, forced into the content-hashed client
|
// The codeIcon values above, forced into the content-hashed client
|
||||||
// bundle instead of relying on the (now-disabled) runtime route: that
|
// bundle instead of relying on the runtime route: that route's URL
|
||||||
// route's URL doesn't change between builds, so a browser or CDN
|
// doesn't change between builds, so a browser or CDN caching an old (or,
|
||||||
// caching an old (or, before the serverBundle fix above, broken)
|
// before the serverBundle fix above, broken) response for it kept
|
||||||
// response for it kept serving that stale result until the cache
|
// serving that stale result until the cache expired or was purged,
|
||||||
// expired or was purged, which is what "icon disappears until a hard
|
// which is what "icon disappears until a hard refresh" actually was.
|
||||||
// refresh" actually was. `scan: true` catches any other icon used
|
// `scan: true` catches any other icon used literally in .vue/.ts
|
||||||
// literally in .vue/.ts source; scanContentIcons() above covers content
|
// source; scanContentIcons() above covers content the same way it does
|
||||||
// the same way it does for serverBundle. vscode-icons' per-file-
|
// for serverBundle. vscode-icons' per-file-extension icons aren't
|
||||||
// extension icons aren't listed here: there are too many to enumerate
|
// listed here: there are too many to enumerate and new file types keep
|
||||||
// and new file types keep appearing in content, so with the API
|
// appearing in content, so an unbundled one falls back to the runtime
|
||||||
// fallback disabled, an unbundled one now renders as a missing icon
|
// route client-side, same as before this whole fix, just no longer for
|
||||||
// instead of a broken network request; still preferable to a CSP
|
// every collection used in content.
|
||||||
// violation, and serverBundle above still renders it correctly in the
|
|
||||||
// page's own initial prerendered HTML.
|
|
||||||
clientBundle: {
|
clientBundle: {
|
||||||
scan: true,
|
scan: true,
|
||||||
icons: [...new Set([
|
icons: [...new Set([
|
||||||
|
|||||||
Reference in New Issue
Block a user