question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot resolve relative references in nested .scss files with react-scripts@2.0

See original GitHub issue

Structure

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:closed
  • Created 5 years ago
  • Reactions:4
  • Comments:8 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
iamandrewlucacommented, Nov 16, 2018

stale bot trigger 😄

0reactions
stale[bot]commented, Dec 21, 2018

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found