umi项目,页面引入html文件,报错:
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file.
解决方法
- 安装file-loader
npm install file-loader --save
- 配置.umirc.js,添加loader
export default defineConfig({
chainWebpack: (config) => {
config.module
.rule('html')
.test(/\.(html)$/)
.use('file-loader')
.loader(require.resolve('file-loader'))
},
})