Description
If react-md is installed with npm and React 16, the following error occurs when trying to compile sass files:
SassError: Can't find stylesheet to import.
╷
1 │ @use "@react-md/theme/dist/color-palette" as *;
│ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
╵
src/variables.scss 1:1 @use
src/App.scss 1:1 root stylesheet
This occurs because for some reason the node_modules directory does not include all the scoped react-md packages at node_modules/@react-md/. The folder structure looks something like this:
node_modules
├── @react-md
│ └── utils
├── react-md
│ ├── node_modules
│ │ └── @react-md
│ │ │ ├── alert
│ │ │ ├── avatar
│ │ │ ├── # ...all other scoped packages...
│ │ │ ├── utils
All the scoped packages should be flattened to the root node_modules instead of the node_modules/react-md/node_modules folder for the sass imports to work.
Since this only occurs with React 16 as a dependency, I think it might be because I forgot to add the peerDependencies to the @react-md/utils's package.json file.
Workaround
- installing all the scoped packages along with the main
react-md package will make the node_modules folder correctly flattened
- using React 17 instead of React 16
- using
yarn? (untested)
Description
If
react-mdis installed with npm and React 16, the following error occurs when trying to compile sass files:This occurs because for some reason the
node_modulesdirectory does not include all the scopedreact-mdpackages atnode_modules/@react-md/. The folder structure looks something like this:All the scoped packages should be flattened to the root
node_modulesinstead of thenode_modules/react-md/node_modulesfolder for the sass imports to work.Since this only occurs with React 16 as a dependency, I think it might be because I forgot to add the
peerDependenciesto the@react-md/utils'spackage.jsonfile.Workaround
react-mdpackage will make thenode_modulesfolder correctly flattenedyarn? (untested)