Closed Drew-Daniels closed 1 year ago
It's been awhile since I've looked at the v1 -> v2 migration stuff so my memory is a bit hazy.
Would switching the react-md
import to:
-@use "react-md/dist/scss/react-md";
+@use "~react-md/dist/react-md";
Looking back at the v2 website, it looks like the dist/scss
folder is for non-webpack node-sass usage so it might fix it?
Another option might be using the SASS_PATH
(?) environment variable to include node_modules
. https://github.com/facebook/create-react-app/issues/4494#issuecomment-442326592
SASS_PATH=node_modules:src
I can't remember which version of create-react-app
that was added in though.
Found out what the issue was, and it was entirely unrelated to react-md
!
For some reason - this project had been manually transpiling our scss
to css
with dart-sass
instead of letting react-scripts
/node-sass
handle this:
"build-css": "sass src:src --load-path=src/ --load-path=. --quiet",
"watch-css": "npm run build-css && sass src:src --load-path=src/ --load-path=. --watch --quiet",
"start-js": "PORT=3001 REACT_APP_MOCK=none react-scripts start",
"start": "npm-run-all -p watch-css start-js",
Additionally, much of our component files had been manually importing these manually processed .css
files instead of .scss
files.
Now, I have updated our start
script to the following:
"start": "PORT=3001 REACT_APP_MOCK=none react-scripts start",
... and updated our styling imports to import .scss
files instead of .css
and everything works.
I did also have to add this as well to our .env
file:
SASS_PATH=node_modules:src
Thanks for the help @mlaursen .
I am getting an error message of:
Error: Can't find stylesheet to import.
when I upgrade mycreate-react-app
project'sreact-md
version from v1 to v2.My goal is to fully upgrade
react-md
to v5, but I am getting stuck on the step to upgrade to v2.Our project has the following dependencies:
My environment:
yarn 1.22.19
14.19.0
When I upgrade from
react-md
^1.2.9
to^2.0.0
and runyarn start
, I get the following error:app.scss
looks like this:I have been looking over the migration guide notes from v1 to v2, but I cannot seem to find anything that has any information related to this problem.
As mentioned in this MR, I have tried the following, but none of them work (for me).
yarn
react v17
Additionally, I have tried:
node_modules/
with~
in my imports like this:// to @use '~react-md/dist/scss/react-md';