adrianhajdin / project_3D_developer_portfolio

The most impressive websites in the world use 3D graphics and animations to bring their content to life. Learn how to build your own ThreeJS 3D Developer Portfolio today!
https://jsmastery.pro
6.1k stars 1.37k forks source link

Hi Adrian, I have a question on importing styles in Contact.jsx. #20

Open kohta9521 opened 1 year ago

kohta9521 commented 1 year ago

Thanks Adrian for all your great videos.

I have one ERROR happening in the part of App.jsx that imports each component, specifically this code. The imoprt statement in the Contact.jsx file says it can't find the styles file, and pasting the Github code doesn't work, so I need your help!

[plugin:vite:import-analysis] Failed to resolve import "../styles" from "src/components/Works.jsx". Does the file exist?
/Users/?????/Desktop/Portfolio/src/components/Works.jsx:5:23
17 |  import Tilt from "react-tilt";
18 |  import { motion } from "framer-motion";
19 |  import { styles } from "../styles";
   |                          ^
20 |  import { github } from "../assets";
21 |  import { SectionWrapper } from "../hoc";

I'm not sure if the file itself exists, because I've had no errors with the styles import on other components.

I live in Japan and my English is not very good, so there might be something wrong with my writing. I'm sorry if I'm wrong, but please help me.

Alecfut07 commented 1 year ago

I have the same error as you, but in my case, I had a file called "style.js" inside the src folder. So I just need to rename the file to "styles.js".

kohta9521 commented 1 year ago

Thanks for the answer! I changed style.js to styles.js as you taught me and the error disappeared the first time. However, the next time I imported the SectionWrappern section, the error appeared.

20 |  import { styles } from "../styles";
21 |  import { experiences } from "../constants";
22 |  import { SectionWrapper } from "../hoc";
   |                                  ^
23 |  import { textVariant } from "../utils/motion";
24 |  const ExperienceCard = ({

Did you get the same error?

Alecfut07 commented 1 year ago

Yeah, I also got the same error, but I already fixed it. You need to do this in index.js and SectionWrapper.jsx from hoc folder: index_js SectionWrapper_jsx

Mthegamer commented 1 year ago

Thanks Adrian for all your great videos.

I have one ERROR happening in the part of App.jsx that imports each component, specifically this code. The imoprt statement in the Contact.jsx file says it can't find the styles file, and pasting the Github code doesn't work, so I need your help!

[plugin:vite:import-analysis] Failed to resolve import "../styles" from "src/components/Works.jsx". Does the file exist?
/Users/?????/Desktop/Portfolio/src/components/Works.jsx:5:23
17 |  import Tilt from "react-tilt";
18 |  import { motion } from "framer-motion";
19 |  import { styles } from "../styles";
   |                          ^
20 |  import { github } from "../assets";
21 |  import { SectionWrapper } from "../hoc";

I'm not sure if the file itself exists, because I've had no errors with the styles import on other components.

I live in Japan and my English is not very good, so there might be something wrong with my writing. I'm sorry if I'm wrong, but please help me.

I also got the same error. I have managed ti fix it by writing it as ../style instead of ../styles. Hope it will fix your problem too.

I belive its pointing to the style.js file so if just type ../ you will get the list of files in Visual Code and select the style js file.