Description
Describe the bug
When importing Sass partials one must use @import and not @use as the docs suggest.
Did you try recovering your dependencies?
yes. npm version = 8.4.1
Which terms did you search for in User Guide?
'use import sass partial'
Environment
current version of create-react-app: 5.0.0
running from /Users/alexkio/.npm/_npx/c67e74de0542c87c/node_modules/create-react-app
System:
OS: macOS 12.2
CPU: (10) x64 Apple M1 Pro
Binaries:
Node: 14.16.0 - ~/.nvm/versions/node/v14.16.0/bin/node
Yarn: 1.22.17 - ~/.nvm/versions/node/v14.16.0/bin/yarn
npm: 8.4.1 - ~/.nvm/versions/node/v14.16.0/bin/npm
Browsers:
Chrome: 98.0.4758.80
Edge: Not Found
Firefox: Not Found
Safari: 15.3
npmPackages:
react: ^17.0.2 => 17.0.2
react-dom: ^17.0.2 => 17.0.2
react-scripts: 5.0.0 => 5.0.0
npmGlobalPackages:
create-react-app: Not Found
Steps to reproduce
- npx create-react-app my-app
- cd my-app
- npm start
- npm install sass
- rename App.css to App.scss
- create _variables.scss with
$grey-dark: #282c34;
- in App.scss
@use './_variables.scss';
and changebackground-color: #282c34;
tobackground-color: $grey-dark;
Expected behavior
npm start should load without errors
Actual behavior
Module build failed (from ./node_modules/sass-loader/dist/cjs.js):
SassError: Undefined variable.
╷
19 │ background-color: $grey-dark;
Reproducible demo
Project that fails to build using npm start and @use as suggested in the docs