How to fix the error Cannot find module './audio/audio1.mp3' or its corresponding type declarations. also already use the require('./audio/audio1.mp3')
and also getting an error.
How to fix the error Cannot find module './audio/audio1.mp3' or its corresponding type declarations. also already use the require('./audio/audio1.mp3')
and also getting an error.
1 Answer
Reset to default 6Inside the src/react-app-env.d.ts
add this:
/// <reference types="react-scripts" />
declare module '*.mp3'; // '*.wav' if you're using wav format
Now you can use it like this:
import audio1 from './audio/audio.mp3';
const myAudio = new Audio(audio1);
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745324987a4622614.html
评论列表(0条)