nuxt / website-v2

Nuxt 2 Documentation Website

Home Page:https://v2.nuxt.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Can't load MP3 file at latest NuxtJS 2.15.8

artrayd opened this issue · comments

Just installed fresh NuxtJS 2.15 and wanted to load MP3 file

// index.vue
new Audio(require("@/assets/created.mp3"));

According to documentation should work like this:

//nuxt.config.js
  build: {
    extend(config, ctx) {
      config.module.rules.push({
        test: /\.(ogg|mp3|wav|mpe?g)$/i,
        loader: "file-loader",
        options: {
          name: "[path][name].[ext]",
        },
      });
    },
  },

But it doesn't work! I get this error:

Module parse failed: Unexpected character '' (1:3)                                                              friendly-errors 11:33:05
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders

Also reproduced the problem at Codesandbox

https://codesandbox.io/s/xenodochial-sanderson-cpeb7p?file=/pages/index.vue:1186-1354

For my other project that works very well, I can't understand what's the problem(

That's me stupid, I had empty "build: {}" just few lines below, the second one overrides my settings