react-gsap icon indicating copy to clipboard operation
react-gsap copied to clipboard

Can't import the script on a react online

Open netgfx opened this issue 3 years ago • 2 comments

getting SyntaxError: The requested module '/-/[email protected]/dist=es2020,mode=imports/unoptimized/dist/ScrollTrigger.js' does not provide an export named 'ScrollTrigger'

using it like import { PlayState, Tween } from "https://cdn.skypack.dev/react-gsap"

any ideas?

netgfx avatar Aug 29 '21 06:08 netgfx

I have no experience with skypack. The issue seems to be the es5 import here: https://github.com/bitworking/react-gsap/blob/master/packages/react-gsap/src/tools/ScrollTrigger.tsx#L3

I had to do it, else you'd have to transpile node_modules if you want to use react-gsap in an es5 environment. Maybe you can fix that by using the dist parameter? https://docs.skypack.dev/skypack-cdn/api-reference/lookup-urls#forced-browser-support

bitworking avatar Aug 30 '21 08:08 bitworking

I've tried them all with no luck, even tried the ?dts as the project is in Typescript but nothing changed. :(

netgfx avatar Aug 30 '21 08:08 netgfx