我刚开始使用 Gatsby 进行开发(或一般做前端),我想使用React Suite在我的网站上添加一个导航栏。但是,在 my 中导入相应的样式表时index.js
:
import 'rsuite/lib/styles/index.less';
运行时收到以下消息gatsby develop
:
ERROR #98124 WEBPACK
Generating development JavaScript bundle failed
Can't resolve 'rsuite/lib/styles/index.less' in '/Users/.../src/pages'
If you're trying to use a package make sure that 'rsuite/lib/styles/index.less' is installed. If you're trying to use a local file make sure that the path is correct.
File: src/pages/index.js:14:0
failed Building development bundle - 7.237s
ERROR in ./src/pages/index.js 14:0-38
Module not found: Error: Can't resolve 'rsuite/lib/styles/index.less' in '/Users/.../src/pages'
@ ./.cache/_this_is_virtual_fs_path_/$virtual/async-requires.js 31:11-33:5
@ ./.cache/app.js 17:0-52 28:0-70 30:27-40 28:0-70
webpack compiled with 1 error
我已经尝试了很多东西:安装和重新安装rsuite
,安装和重新安装gatsby-plugin-less
,less
清除缓存,尝试各种配置gatsby-config.js
,但我真的没有选择。
同时,react-bootstrap
通过同样的方式安装和导入样式表
import "bootstrap/dist/css/bootstrap.min.css";
不会产生错误并应用样式表。
非常感谢您的帮助!