Skip to content

Local icon 404 after nuxi generating if with :name="flag?'my-icon:icon-a':'my-icon:icon-b'" #380

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
gyhyfj opened this issue Mar 26, 2025 · 0 comments

Comments

@gyhyfj
Copy link

gyhyfj commented Mar 26, 2025

Re product:
In index.vue:

const flag = ref(true)
// ...

<Icon :name="flag ? 'my-icon:a' : 'my-icon:b'" />
<!-- OR -->
<Icon name="my-icon:a" v-if="flag" />
<Icon name="my-icon:b" v-else />

in nuxt.config.ts

icon: {
  provider: 'server',
  customCollections: [
    {
      prefix: 'my-icon',
      dir: './assets/icon/svg',
    },
  ],
},
// ...
nitro: {
  preset: 'static',
},

If toggle value of flag,
everything works well in development,
but it throws 404 error for my-icon:b after building and generating.
(it works well with v-show)

Project info:

------------------------------
- Operating System: Windows_NT
- Node Version:     v22.8.0
- Nuxt Version:     3.16.0
- CLI Version:      3.23.0
- Nitro Version:    2.11.6
- Package Manager:  [email protected]
- Builder:          -
- User Config:      modules, icon, colorMode, shadcn, fonts, googleSignIn, app, imports, css, vite, nitro, compatibilityDate, telemetry
- Runtime Modules:  @nuxtjs/[email protected], @nuxt/[email protected], @nuxt/[email protected], @nuxt/[email protected], @nuxt/[email protected], @pinia/[email protected], pinia-plugin-persistedstate/[email protected], @nuxt/test-utils/[email protected], @nuxtjs/[email protected], [email protected], @vueuse/[email protected], [email protected]
- Build Modules:    -
------------------------------
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant