Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

214
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!