I encountered an issue when attempting to include a background image in react js.
./src/index.css (./node_modules/css-loader/dist/cjs.js??ref--5-oneOf-4-1!./node_modules/postcss-loader/src??postcss!./src/index.css)
Unable to locate module: An attempt was made to import ../public/img/bg.jpg, which is outside of the project src/ directory.
Imports from paths outside of src/ are not allowed.
This is my css:
section{
position: fixed;
top: 0;
left: 0;
height: 100vh;
background: url("../public/img/bg.jpg");
background-attachment: fixed;
}
.container{
position: relative;
margin-top: 200vh;
background: #fff;
padding: 100px;
}