Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

218
Visualizações
404 not found svg in nuxt

I want to show some country flags with this plugin (https://www.growthbunker.dev/vueflags/)

The folder with flags is in:

.app/
  ../assets/flags <- HERE
  ../components
  ../layouts
  .. etc

Plugin settings

// plugins/vueflags.js

import Vue from "vue";
import VueFlags from "@growthbunker/vueflags";

Vue.use(VueFlags, {
    // Specify the path of the folder where the flags are stored.
    iconPath: 'assets/flags',
  });

finally i call the component (french's flag should be rendered)

<gb-flag code="fr" size="small" />

But i get this error

GET http://localhost:3000/assets/flags/fr.svg 404 (Not Found)

I tried with iconPath: '~/assets/flags', same error:

GET http://localhost:3000/~/assets/flags/fr.svg 404 (Not Found)

in nuxt.config.js:

buildModules: [
    [
      "@nuxtjs/vuetify",
      {
        /* module options */
      },
    ],
    ["@nuxtjs/svg"],
  ],
over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

I created this repo if you want to see an implementation: https://github.com/r9mp/stackoverflow-vueflags

To do this in a short version : put your flags/*.svg in the static directory.

I tried to make it work with the assets/ directory, but it seems a bit tricky for (I think) this reasons: files smaller than 1kb are converted in base64 and so your flags are not copied to /_nuxt/flags/*.svg. From the documentation: "Which means that every file below 1 kB will be inlined as base64 data URL. Otherwise, the image/font will be copied in its corresponding folder (inside the .nuxt directory) with a name containing a version hash for better caching." (https://nuxtjs.org/docs/directory-structure/assets#webpack-assets)

Or maybe wepback just does not understand the vueflags config and so does not import files in build... I'll try to investigate further!

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda