小编Igo*_*ade的帖子

使用 Nuxt.js 加载 .mp3 文件

我在使用 Nuxt.JS (Vue.js) 加载 .mp3 文件时遇到问题...

我尝试在没有特定加载器的情况下加载文件,webpack 告诉他需要一个特定的加载器来加载该文件,当我在 nuxt.config.js 文件中添加 url-loader 时:

 build: {
/*
** Run ESLint on save
*/
extend (config, { isDev, isClient }) {
  if (isDev && isClient) {
    config.module.rules.push({
      enforce: 'pre',
      test: /\.(js|vue)$/,
      loader: 'eslint-loader',
      exclude: /(node_modules)/
    })

    config.module.rules.push({
      test: /\.(ogg|mp3|wav)$/i,
      loader: 'url-loader'
    })

  }
}
Run Code Online (Sandbox Code Playgroud)

抛出错误:

TypeError
Cannot read property 'middleware' of undefined
Run Code Online (Sandbox Code Playgroud)

有人在 Nuxt.Js 中使用过其他加载器吗?

提前致谢!

webpack vue.js nuxt.js

1
推荐指数
1
解决办法
3628
查看次数

标签 统计

nuxt.js ×1

vue.js ×1

webpack ×1