Vue加载audio文件错误的解决


在webpack.base.config.js加上

{
        test: /\.mp3(\?.*)?$/,
        loader: 'url-loader',
        options: {
          limit: 10000,
          name: utils.assetsPath('media/[name].[hash:7].[ext]')
        }
      }

将vue-loader.conf.js改为

var utils = require('./utils')
var config = require('../config')
var isProduction = process.env.NODE_ENV === 'production'

module.exports = {
  loaders: utils.cssLoaders({
    sourceMap: isProduction
      ? config.build.productionSourceMap
      : config.dev.cssSourceMap,
    extract: isProduction
  }),
  transformToRequire: {
    "audio": "src"
  }
}

你可能感兴趣的:(Vue加载audio文件错误的解决)