Closed bezzskilla closed 2 years ago
Thank you for your feedback. Can you provide a minimal reproduction to help me locate the issue?
yep, some time
https://codesandbox.io/embed/next-js-forked-77c1t0?fontsize=14&hidenavigation=1&theme=dark
code like this but u shold do next build
and next start
for my case. I think sandbox couldnt do it
Are you using the next@3
?
Test on next@12
and everything is OK.
So the issue may be that next@3
can not select esm
/cjs
correctly.
i use next 11
seamless-scroll-polyfill@2.1.6
works well on both next@11
and next@12
.
There are some compatibility issues in next@10
. I have just released 2.1.7 to improve compatibility.
I test it from next@8
to next@12
, it works well.
For versions below next@8
, I couldn't continue testing because of some compatibility issues between React
and next
.
Since you are using next 11 so you may be experiencing a different issue. But it's still worth trying to upgrade to 2.1.7.
so, i locally created next app. On last version all is okey. But on next 11.1.3
its not working. I can give u repository with code if u want.
i was using scroll 2.1.7
I also understand that this is not the latest version, so it may not be rational to fix something on it, I just inform you
By the way 11.1.3 is the latest version of 11 next
Does the 2.1.7 version works on next@11.1.3
?
no, check it pls
https://github.com/bezzskilla/scroll-bug
dev - works build + start - not works
scroll api - 2.1.7 next - 11.1.3
Thanks, it helps a lot. I will check it out in depth.
The webpack in next@11
cannot handle ??
logic correctly.
The following code will be inlined and transformed into wrong result.
This issue will be bypassed in these cases.
next.config.js
by config.optimization.minimizer = []
next.js
seamless-scroll-polyfill@2.1.8
I just released 2.1.8. which downgraded the build target to es6.
nice! thx, i'll check it in the evening
thx again, all works perfect!
i was using old your API for a long time. Now i decided to upd it to
2.1.6
. So I rewrite methodwindowScrollTo
My code:
import { windowScrollTo } from 'seamless-scroll-polyfill';
<div onClick={handleScroll} className={className}> {children} </div>
andhandleScroll
is calculating offsetPosition and scroll in the end:window && windowScrollTo(window, { top: offsetPosition, behavior: "smooth", });
All is perfect when i check
next dev
in Next.js, but it not works, when I usenext build
I tryied another methods likewindowScroll
or do it intry-catch
or checkisWindow
but without success