vue项目中引入pcm文件报错

现象:vue项目中引入pcm文件失败

  • 报错内容
Module parse failed: Unexpected character ' ' (1:0)
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
  (Source code omitted for this binary file)

vue项目中引入pcm文件报错_第1张图片

解决办法:在webpack中配置中加上pcm格式

module/rules
{
	test: /\.(mp4|webm|ogg|mp3|wav|flac|aac|pcm)(\?.*)?$/,
	 loader: 'url-loader',
	 options: {
	   limit: 10000,
	   name: 'media/[name]--[folder].[ext]'
	 }
},

总结:最开始报错之后,尝试其他音频格式是否正常,如果正常就推断出未配置上pcm格式找到解决办法。

你可能感兴趣的:(vue项目中引入pcm文件报错)