Reputation: 1213
I'm just starting out developing with Gatsby (or doing frontend in general) and I wanted to add a Navigation bar to my website using React Suite. However, when importing the corresponding stylesheet in my index.js
:
import 'rsuite/lib/styles/index.less';
I get the following message when running 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
I tried so many things already: installing and reinstalling rsuite
, installing and reinstalling gatsby-plugin-less
and less
, clearing the cache, trying all kinds of configurations in gatsby-config.js
, but I'm out of options really.
Meanwhile, installing react-bootstrap
and importing the stylesheet similarly through
import "bootstrap/dist/css/bootstrap.min.css";
does not produce the error and the stylesheet gets applied.
Would greatly appreciate your help!
Upvotes: 0
Views: 2035
Reputation: 46
You can try this:
import "rsuite/src/styles/themes/default/index.less"
https://github.com/rsuite/rsuite/blob/next/examples/with-gatsby/src/pages/index.js#L4
Upvotes: 0
Reputation: 29315
I think you should be using:
import '~rsuite/lib/styles/index.less';
Notice the ~
, as it is inferred from the docs.
Upvotes: 0