1

Made the app with vue ui, Vue v2 + TypeScript.

For some component I need to import .png file.

In TypeScript part I'm trying to import:

import i7 from '@/assets/nimg/7.png';

or

import * as i7 from '@/assets/nimg/7.png';

Add imported as a data to component, and then put it to template:

<img src={i7} alt="" />

Well, I have in terminal:

Cannot find module '@/assets/nimg/7.png' or its corresponding type declarations.

File is there, so I think the problem is in type.

Is this means a need to fix some rules in tsconfig.json, or babel.config.js?

And if yes, what changes I need to put there?

Alx Aux
  • 53
  • 7

0 Answers0