You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I went through the whole Styles And Assets section in the CRA docs.
Environment
System:
OS: Linux 4.18 Ubuntu 18.10 (Cosmic Cuttlefish)
CPU: x64 Intel(R) Core(TM) i5-3330 CPU @ 3.00GHz
Binaries:
Node: 11.2.0 - /usr/bin/node
npm: 6.4.1 - /usr/bin/npm
Browsers:
Chrome: 70.0.3538.110
Firefox: 63.0
npmPackages:
react: Not Found
react-dom: Not Found
react-scripts: Not Found
npmGlobalPackages:
create-react-app: Not Found
Steps to Reproduce
> npx create-react-app my-app && cd my-app
> npm i -S node-sass
> Rename App.css into App.scss, update App.js imports.
> Create _vars.scss in src/ dir. Add a sample variable in there.
> Use that var in App.scss (it works), import _vars.scss as follows:
@import 'vars';
> Create a new component in src/components dir, add an .scss for it.
> Try to import _vars.scss as @import 'vars'; (FAILS with File to import not found or unreadable: vars.)
In earlier versions of CRA, Sass tutorial was recommending to use node-sass-chokidar with --include-path switch (specified in package.json scripts) to enable imports from src/ directory.
Now docs tell to just install node-sass, say nothing about tweaking the build scripts and sass imports from src/ apparently should work automatically (which they don't, or I am missing something).
I will continue investigating this on my own, but right now the documentation is misleading and that should be fixed.
Is this a bug report?
Possibly.
Did you try recovering your dependencies?
Yes,
npm v6.4.1
Which terms did you search for in User Guide?
I went through the whole
Styles And Assets
section in the CRA docs.Environment
Steps to Reproduce
Expected Behavior
Sass imports from ./src (non-relative paths, like @import 'vars') are expected to work for sass stylesheets located deeper in the file tree.
At least that's what the docs say: https://facebook.github.io/create-react-app/docs/adding-a-sass-stylesheet (scroll to the bottom).
node-sass-chokidar
with--include-path
switch (specified in package.json scripts) to enable imports from src/ directory.node-sass
, say nothing about tweaking the build scripts and sass imports from src/ apparently should work automatically (which they don't, or I am missing something).I will continue investigating this on my own, but right now the documentation is misleading and that should be fixed.
Reproducible Demo
Derived from
Steps to Reproduce
section:https://github.com/arkadyt/sass-imports-bug-cra
The text was updated successfully, but these errors were encountered: