【发布时间】:2021-12-04 16:52:20
【问题描述】:
在我的 Typescript React 应用程序中添加 .gif 文件后出现错误,如下所示。
./src/gif/moving.gif 1:6
Module parse failed: Unexpected token (1:6)
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
下载“文件加载器”后,我在 webpack 设置中添加了一些配置
{
test: /\.scss$/,
use: ['style-loader', 'css-loader', 'sass-loader'],
},
// new setting for gif loader
{
test: /\.(gif|svg|jpg|png)$/,
loader: "file-loader",
},
我仍然收到配置错误的任何原因?
【问题讨论】:
标签: reactjs typescript web webpack next.js