My folder structure is as follows:
In my App.Js (which is under the components folder), I have:
import variables from \'/src/EnvVariables/varia
Have you tried to import with the relative path? (with one or more ../
sections)
import variables from "../EnvVariables/variables.json"
Of course, if you prefer absolute paths you can setup https://webpack.js.org/configuration/resolve/, but I believe for first, you should try the first solution
if you just need to import your any file to a component : (just follow this steps)
.env
file in src
directory . .env
file you need to add this line only NODE_PATH = src/
import "Home.css"
(your file name will be here) to a component from src
, it will take it easily. npm start
from
a new terminal.Do ../../
before path
source={require('../../assets/eating.png')}