Skip to content

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

Description

@igodorogea

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"

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions