SCSS Error: can not read files in public path
I have an assets folder that contain some other files with images and svgs in it in the public file of my project so...
=>
navbar.scss
...I declared a variable with path below
Error: Module not found: Error: Can't resolve '../../../logos/mobile.jpg’
10 Replies
Can we see your folder structure?
Are you using absolute paths? It seems you configured your absolute path to start at src/
You'd need to configure it to start in your react root directory
And then do something like
public/assets/logos/{image}
ok
The problem is that i didnt write the code , its an existing project im trying to work on
I would talk to your team about it then because if you change where the absolute path is pointed to it will change all other import paths
please how do i change path ?
Im just gonna try it if it solves the problem'
I'm not sure off the top of my head, you'd have to look up how to set absolute paths in react
Stack Overflow
Import react components with absolute path
Here is my test file
// /imports/components/main.test.js
import React from 'react'
import { shallow, mount } from 'enzyme'
import Main from './main'
import TextInput from "/imports/ui/textInput"
....
You will need to change every other path that uses an absolute path though. Easier option would be to just move the asset folder into src
But I'm not sure if your team wants that
ok
thanks