I'm trying to use an SVG file as a custom icon, using this structure in nuxt.config.js:
import UploadIcon from '@/components/icons/UploadIcon'
export default {
...
vuetify: {
customVariables: ['~/assets/variables.scss'],
icons: {
values: {
upload: {
component: UploadIcon <------here is my custom icon
}
}
}
}
},
Nuxt is showing error:
│ ✖ Nuxt Fatal Error │
│ │
│ Error: Cannot find module '@/components/icons/UploadIcon' │
│ Require stack: │
│ - C:\Users\Admin\Documents\portfolio\artwork\artwork\nuxt.config.js │
The thing is that IDE automatically does such import:
import UploadIcon from '@/components/icons/UploadIcon'
And it doesn't work. What I tried:
- doing
~instead of@in path to component. - other variations of path, including absolute path.
However, when I try to use absolute path it shows such an error:
╭───────────────────────────────────────╮
│ │
│ ✖ Nuxt Fatal Error │
│ │
│ SyntaxError: Unexpected token '<' │
│ │
╰───────────────────────────────────────╯
So I can't find a way, I checked these documentations:
- https://github.com/nuxt-community/vuetify-module#defaultassets
- https://vuetifyjs.com/en/features/icon-fonts/
Generally I've been trying to follow this answer: https://stackoverflow.com/a/58563938/7017890
but there is a regular vuetify.js config file being used. With Nuxt it doesn't work.