home-bg.mp4:1 Uncaught Error: Module parse failed: Unexpected character '
这是报错
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)
当webpack 出现此类报错,则说明没有相关配置, 需要再webpack.config.js 文件夹内写入相对应的模块配置
// 视频
{
test: /.(mp4|mp3|webm)$/,
type: 'asset',
parser: {
dataUrlCondition: {
maxSize: 10 * 1024,
}
},
generator: {
filename: 'static/medias/[name][ext]'
}
},