Answer the question
In order to leave comments, you need to log in
Why do I get the error: Cannot find module './my_module'?
When I upload a song to the database, I redirect myself to the main page, where all the songs are displayed, but I get this error: Cannot find module './my_song.mp3', although after reloading the page everything works without errors
I get songs from the database data
async mounted() {
try {
const token = this.$store.getters["auth/getToken"];
const { result, ok } = await this.$store.dispatch("user/getData", {
data: ["songs"],
token,
});
let songs = [];
if (ok) {
songs = result.songs.map((song) => {
song.active = false;
// Думаю, что ошибка здесь
song.audio = new Audio(require(`@/uploads/${song.file}`).default);
song.currentTime = 0;
song.audio.volume = this.getVolume;
song.volume = this.getVolume;
return song;
});
}
this.$store.commit("setSongs", songs);
if (localStorage.getItem("volume")) {
this.$store.commit(
"setVolume",
JSON.parse(localStorage.getItem("volume"))
);
}
} catch (err) {
throw err;
}
},
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question