I am trying to bundle my React app as a npm package, to import it in another react app. It was working fine, but then I had to use gsap in my project and now the build of my app is not working anymore.
I use rollup to bundle my app and I get the following error :
[!](plugin rpt2)RollupError: src/components/Background/Background.tsx:7:22- error TS2307:Cannot find module'gsap'or its corresponding type declarations.7import{ gsap }from"gsap";~~~~~~
src/components/Background/Background.tsx:9:31- error TS2307:Cannot find module'gsap/ScrollTrigger'or its corresponding type declarations.9import{ScrollTrigger}from"gsap/ScrollTrigger";~~~~~~~~~~~~~~~~~~~~
Any help would be appreciated, I scrolled all the internet but found nothing, it seems that the problem comes from the rollup-plugin-typescript2 plugin, but it raises this error only with gsap module, everything else is working fine.
GSAP not recognized in rollup bundle
in GSAP
Posted
Hi,
I am trying to bundle my React app as a npm package, to import it in another react app. It was working fine, but then I had to use
gsap
in my project and now the build of my app is not working anymore.I use
rollup
to bundle my app and I get the following error :Here is my rollup config :
Here is my tsconfig :
Any help would be appreciated, I scrolled all the internet but found nothing, it seems that the problem comes from the
rollup-plugin-typescript2
plugin, but it raises this error only withgsap
module, everything else is working fine.