#Scss and @use from node_modules doesn't correctly import fonts and images

1 messages · Page 1 of 1 (latest)

marsh drum
#

I try to use scss from node modules like this:

$primary: #ff0000;

@use "./node_modules/react-widgets/lib/scss/react-widgets.scss" with (
  $state-bg-select: $primary,
  $state-border-focus: $primary
);

But this won't correctly import fonts and images from the source file. Is there any way around it?

#

The color is changed correctly but react-widgets.scss has some fonts and images and their paths are wrong and won't load correctly

#

I will get this error in console:

GET http://localhost:3000/fonts/rw-widgets.woff?v=4.1.0 404 (Not Found)
#

The path should be something like:

GET http://localhost:3000/node_modules/react-widgets/dist/fonts/rw-widgets.woff?v=4.1.0
#

Is there some option that i'm missing in vite config?