darkroomengineering / lenis

How smooth scroll should be
https://lenis.darkroom.engineering
MIT License
8.73k stars 377 forks source link

v 0.2.26 : 'TinyEmitter' exporting problem with create-react-app #76

Closed abirtasrif closed 1 year ago

abirtasrif commented 1 year ago

Description Though its working perfectly with version 0.2.21 . My dev-server returning below error with version 0.2.26 - ./node_modules/@studio-freight/lenis/dist/lenis.mjs Can't import the named export 'TinyEmitter' from non EcmaScript module (only default export is available)

Below is the hook code that used- import { useEffect } from "react"; import Lenis from "@studio-freight/lenis";

export const useSmoothScroll = () => const lenis = new Lenis({ duration: 1.5, easing: (t) => Math.min(1, 1.001 - Math.pow(2, -10 * t)), direction: "vertical", smooth: true, });

useEffect(() => { function raf(time) { lenis.raf(time); requestAnimationFrame(raf); }

requestAnimationFrame(raf); }, []); };

clementroche commented 1 year ago

This seems to be a common issue from create-react-app Sources: -https://github.com/framer/motion/issues/1307 -https://github.com/facebook/create-react-app/issues/10356

You can look for solution on those threads, one from Framer suggests to use create-react-app@next

BleXor commented 1 year ago

@abirtasrif

Hello, I've had similar issue in Vue/Nuxt - solved thanks to this solution: https://github.com/vuejs/pinia/issues/675#issuecomment-945602370

Maybe it can help your case too.

clementroche commented 1 year ago

@abirtasrif any news, is it fixed ?

abirtasrif commented 1 year ago

@abirtasrif any news, is it fixed ?

@clementroche No, but I've used the previous version of lenis which working fine.

clementroche commented 1 year ago

@abirtasrif Can you try again with v1.0.0-dev.5 ?

abirtasrif commented 1 year ago

@clementroche lenis 0.2.28 is working fine.