Cannot resolve relative references in nested .scss files with react-scripts@2.0
See original GitHub issueStructure
my-app
├── node_modules
├── ...
└── src
├── styles
│ ├── fonts
│ │ └── asd.woff
│ ├── fonts.scss
│ └── typo.scss
├── App.js
├── index.scss
└── index.js
index.scss
@import "../styles/fonts";
@import "../styles/typo";
fonts.scss
@font-face {
font-family: "asd";
src: url("./fonts/asd.woff") format("woff");
}
When I’m run npm start
I get this error in console:
Failed to compile.
./src/index.scss)
Module not found: Can't resolve './fonts/asd.woff' in '...'
Possible resolution
As stated here this problem can be solved using resolve-url-loader
.
Dependencies:
"react-scripts": "2.0.0-next.3e165448"
Issue Analytics
- State:
- Created 5 years ago
- Reactions:4
- Comments:8 (1 by maintainers)
Top Results From Across the Web
cannot resolve relative url in scss react - Stack Overflow
I'm attempting to use a relative path within my SCSS to target an image file on my public directory (using native create-react-app ...
Read more >react-app-rewired - npm
1) Install react-app-rewired · 2) Create a config-overrides.js file in the root directory · 3) 'Flip' the existing calls to react-scripts in npm ......
Read more >Babel-plugin-react-css-modules NPM | npm.io
and a corresponding CSS file that matches those CSS classes. Awesome! However, there are several disadvantages of using CSS modules this way: You...
Read more >Build a scalable front-end with Rush monorepo and React
Create a package.json file inside the react-scripts folder and add ... We can't use a relative path in HTML because we don't want...
Read more >How to use SVGs in React | Sanity.io guide
Not only is it a lightweight, infinitely scalable alternative to raster images, it can also be styled, animated with CSS when embedding inline ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
stale bot trigger 😄
This issue has been automatically closed because it has not had any recent activity. If you have a question or comment, please open a new issue.