N
Nuxt2mo ago
MIDI

Importing images shows error in vscode, works in build

Importing images using the syntax import img from '~/assets/img.jpg' It works just fine, but it seems the typescript functionality in vscode doesn't like it. To reproduce, create a new nuxt project, insert an image into the assets directory and reference it in an import.
No description
1 Reply
MIDI
MIDIOP2mo ago
This is a problem with vscode using typescript checking instead of nuxt checking. You can disable it by making a index.d.ts containing:
declare module '*.jpg'
declare module '*.mp4'
declare module '*.jpg'
declare module '*.mp4'
etc..
Want results from more Discord servers?
Add your server