Skip to content

vaamx/threefiber

ย 
ย 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

23 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

React-Three-Fiber-Webflow ๐Ÿ˜˜

Starter file with vite to render react three fiber inside a webflow project. React-three/drei is already includet.

ES-lint with react plugin and prettier is also includet in the repository.

install the dependencies: npm i

run dev server: npm run dev

โœ‹โœ‹โœ‹ During developement you need to add this code inside the head tag of your webflow project:

<script type="module"> import RefreshRuntime from "http://localhost:5173/@react-refresh" RefreshRuntime.injectIntoGlobalHook(window) window.$RefreshReg$ = () => {} window.$RefreshSig$ = () => (type) => type window.__vite_plugin_react_preamble_installed__ = true </script>

...you can remove it on your production build.

๐Ÿ‘‚ During developement, you also need to add this at the end of the body tag:

<script type="module" src="http://localhost:5173/@vite/client"></script> <script type="module" src="http://localhost:5173/src/main.jsx"></script>

๐Ÿ‘‰๐Ÿ‘‰๐Ÿ‘‰ You might need to change the localhost number. for production you want to to change it to the production URL. Don't forget to update the _headers file in the public folder or you will get a CORS ERROR.

To render your project inside Webflow , you also need to add a div with the id="root" and set it to the appropriate size.

Have Fun๐Ÿ˜„

About

React Three Fiber

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 97.3%
  • HTML 1.9%
  • CSS 0.8%