skip to Main Content

I am trying to build a React, Tailwind, Vite project on github pages. I have deployed projects before and not ran into any issues but I am getting this issue on build –
Rollup failed to resolve import "framer-motion" from "/home/runner/work/Refine/Refine/src/components/ Services ".

I have been trying to debug for a few hours now.

The repo link is https://github.com/JaredFunaro/Refine

I believe you can view the action reports to get a better idea of what is going on, any help would be greatly appreciated. Thankyou

2

Answers


  1. Chosen as BEST ANSWER

    So it wasn't able to find the css and other files because I forgot to add the 'base' option in vite config for deployment!

    my original vite.config.js file was -

    import { defineConfig } from 'vite'
    import react from '@vitejs/plugin-react'
    
    export default defineConfig({
      plugins: [react()],
    })
    

    I just had to update the base option to reflect the name of github repo, so the github repo was named "Refine" so I updated the vite.config.js file to say -

    import { defineConfig } from 'vite'
    import react from '@vitejs/plugin-react'
    
    export default defineConfig({
      plugins: [react()],
      base: "/Refine/"
    })
    

  2. Looks like you are importing framer-motion but is not listed as a dependency.

    Simple install it by running:

    npm install framer-motion
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search