I have a create-react-app project, using absolute imports and css modules (scss). I am trying to define a custom font-face but the import is not being resolved.
Tried everything suggested in the documentation.
my folder structure
jsconfig.json
public
src
L assets
L fonts
L impact.ttf
L index.js
L index.scss
in my index.scss
@font-face {
font-family: 'impact';
src: url(./assets/fonts/impact.ttf) format('ttf');
}
my jsconfig.json (for absolute importing)
{
"compilerOptions": {
"baseUrl": "src"
},
"include": ["src"]
}
my index.js imports import './index.scss' at the top of the file.
when i try to compile this code, my component throws an error saying the font file cannot be resolved...
Module not found: Can't resolve './assets/fonts/brush.ttf' in '/Users/xxx/project/src/containers/mycomponent'
Also using node-sass so the scss files work.
Cant figure this one out...