Description
Describe the bug
Exporting keys like this used to work in CRA 3 (react-scripts : 3.4.4) but when we upgraded to CRA 4 (react-scripts : 4.0.0) it stopped working.
After exporting, you can use it like this:
Did you try recovering your dependencies?
1.22.4
Which terms did you search for in User Guide?
export
ICSS
Environment
Environment Info:
current version of create-react-app: 3.4.1
running from /Users/you-haurliu/.config/yarn/global/node_modules/create-react-app
System:
OS: macOS 10.15.7
CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
Binaries:
Node: 12.16.1 - /usr/local/bin/node
Yarn: 1.22.4 - ~/.yarn/bin/yarn
npm: 6.13.4 - /usr/local/bin/npm
Browsers:
Chrome: 87.0.4280.67
Firefox: 82.0
Safari: 14.0
npmPackages:
react: 17.0.1 => 17.0.1
react-dom: 17.0.1 => 17.0.1
react-scripts: 3.4.4 => 3.4.4
npmGlobalPackages:
create-react-app: 1.5.2
Steps to reproduce
- Use CRA and create a project
- install
node-sass
as a dependency to allow forscss
files - Create a new file called
colors.scss
in thesrc
folder - Add this block of code inside
colors.scss
:export {
primary: red;
}
- import this file in
app.js
withimport colors from './colors.scss'
- Apply the style to any
p
tag - For example
<p style={{color: colors.primary}}>
This should be red
</p>
- The text should be red
But if you update react-scripts
to 4.0.0
and delete the node modules and yarn lock. Then yarn and start up the server, the text is white and the colors
object is empty.
Expected behavior
colors
object should contain primary
Actual behavior
colors
object is empty
Reproducible demo
Instructions are included in the link
https://github.com/justsolarry/test-cra