Module not found: Error: Can't resolve ReactJs

Viewed 49

Hello guys a have a problem importing my css file, the error is

Module not found: Error: Can't resolve '../assets/css/component/footer.css'

Im trying to fix it with question on internet but I can't, could you help me?

Thanks a lot

this is my Footer.jsx

import React from 'react';

import logo from '../../assets/images/footer-logo.png';

import '../assets/css/component/footer.css';

const Footer = () => {
  return (
 <div className='footer-top'>
    <div className='auto-container'>
        <div className='top-inner clearfix'>

            <div className='footer-logo pull-left'>
                <div className='bg-color'>
                    <figure className='logo'>
                        <a href="index.js">
                            <img src={logo} alt='Logo' />
                        </a>
                    </figure>
                </div>
            </div>
            <div className='footer-into pull right'>
                <ul className='info-list clearfix'>
                    <li>
                        <i className='flaticon-email'></i>
                        <span>Email Address</span>
                        <h6>
                            <a href="mailto:pressureking007@gmail.com">pressureking007@gmail.com</a>
                        </h6>
                    </li>
                    <li>
                        <i className='flaticon-telephone'></i>
                        <span>We are located at</span>
                        <h6>Tampa, Florida</h6>
                    </li>
                    <li>
                        <i className='flaticon-pin'></i>
                        <span>Phone Line</span>
                        <h6>
                            <a href="tel:8137705290">813-770-5290</a>
                        </h6>
                    </li>
                </ul>
            </div>
        </div>
    </div>
 </div>  )
}

export default Footer

this is my package.json

{
  "name": "afirstchoicetampa",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "@testing-library/jest-dom": "^5.16.4",
    "@testing-library/react": "^13.3.0",
    "@testing-library/user-event": "^13.5.0",
    "bootstrap": "^5.1.3",
    "react": "^18.2.0",
    "react-bootstrap": "^2.4.0",
    "react-dom": "^18.2.0",
    "react-scripts": "5.0.1",
    "web-vitals": "^2.1.4"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject"
  },
  "eslintConfig": {
    "extends": [
      "react-app",
      "react-app/jest"
    ]
  },
  "browserslist": {
    "production": [
      ">0.2%",
      "not dead",
      "not op_mini all"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  }
}

If you need more data just ask me, thanks in advance.

1 Answers

It looks like you are trying to import assets from the public folder - but you can only import from src or one of its subfolders. So if you put your image in the same folder as the Footer code, you can

import logo from './footer-logo.png';
Related