Skip to content

Can't find stylesheet to import. #771

@martinadamec

Description

@martinadamec

Do you want to request a feature or report a bug?
Bug

What is the current behavior?
unable to start app because import sass file throwing error

If the current behaviour is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem. Your bug will get fixed much faster if we can run your code and it doesn't have dependencies other than React. Paste the link to your CodeSandbox (https://codesandbox.io/s/new) example below:
You can use my repo: https://github.com/martinadamec/react-toastify-test
Or easy steps:

npx create-react-app my-app --template typescript
npm i react-toastify sass

Create new file test.scss and add following content:

@import "~react-toastify/scss/main";

and import the file into App.tsx

import "./test.scss";

and start the app

npm start

What is the expected behavior?
is possible to start app

Which versions of React, and which browser / OS are affected by this issue? Did this work in previous versions of React?

  • node 14.19.3
  • npm 6.14.17
  • react 18.1.0 (same situation with v16)

Error log

SassError: Can't find stylesheet to import.
  ╷
1 │ @import "~react-toastify/scss/main";
  │         ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  ╵
  src/test.scss 1:9  root stylesheet
ERROR in ./src/test.scss (./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[1].oneOf[7].use[1]!./node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[1].oneOf[7].use[2]!./node_modules/resolve-url-loader/index.js??ruleSet[1].rules[1].oneOf[7].use[3]!./node_modules/sass-loader/dist/cjs.js??ruleSet[1].rules[1].oneOf[7].use[4]!./src/test.scss)
Module build failed (from ./node_modules/sass-loader/dist/cjs.js):
SassError: Can't find stylesheet to import.
  ╷
1 │ @import "~react-toastify/scss/main";
  │         ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  ╵

Any guess what would be wrong? I solved this by downgrading to react-toastify v8.
Thanks in advance

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions