【发布时间】:2022-02-09 18:24:06
【问题描述】:
我正在使用一个名为 ract-chat-widget 的库,它要求我在我的组件中导入 css,就像这样
import 'react-chat-widget/lib/styles.css
但我的构建失败并出现以下错误:
ERROR in ./node_modules/react-chat-widget/lib/styles.css 1:0
Module parse failed: Unexpected token (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
我也尝试为此添加 css-loader,但错误仍然相同。
{
test: /\.(css)$/,
include: [
path.resolve(__dirname, `./node_modules/react-chat-widget/lib`)
],
use: [
{
loader: `css-loader`,
options: {
includePaths: [
path.resolve(__dirname, `./node_modules/react-chat-widget/lib`)
]
}
}
]
}
我也尝试过以不同格式提供此配置。我不确定还要检查什么。
【问题讨论】:
标签: css reactjs webpack css-loader