Jump to content
Search Community

Gsap + Typescript + Browserify + Babelify Compilation Not Working Well

Gean Franco Volpe
Moderator Tag

Warning: Please note

This thread was started before GSAP 3 was released. Some information, especially the syntax, may be out of date for GSAP 3. Please see the GSAP 3 migration guide and release notes for more information about how to update the code to GSAP 3's syntax. 

Recommended Posts

Gean Franco Volpe
Posted

I've installed and imported GSAP and @types/gsap, and my file.ts import it well, but when i run gulp with the Typescript Gulp Configuration i get this error: Error: Cannot find module 'babelify' from 'D:path-to-directory\node_modules\gsap'.

 

I've installed all babel components until i get one last error that tells me "cannot find the function canCompile". 

Posted

I'm not much of a Browserify/TypeScript/Babel guy myself, so I'm probably not gonna be able to help much but in GSAP's package.json there is this: 

"browserify": {
   "transform": [["babelify", { "presets": ["@babel/preset-env"] }]]
}

...which was strongly recommended by a user that we put that in there. Perhaps you need to install babelify? Or I suppose you could experiment with deleting that line in the package.json file to see if that resolves things for you. 

Gean Franco Volpe
Posted

It seems to be a babelify issue, that can't transform GSAP functions into ES5. I'm getting this error: "TypeError: Cannot read property 'arrayify' of undefined"

at "Function.Babelify.configure (D:\path-to-project-directory\node_modules\babelify\index.js:39:49)". 

 

And this property (arrayify or canCompile) seems to be deprecated and removed here . Maybe the Babelify package isn't update to work without these functions "babel.util.arrayify" and "babel.util.canCompile". If someone have a fresh working install of typescript + gsap + (browserify + babelify), would be nice to share it with me, thanks a lot.

 

In the screenshot uploaded you can see all tsconfig.js devDependencies installed, and the error that i'm getting when try to compile gsap with gulp (browserify + babelify). 

Captura de pantalla (77).png

Posted

I wish I had a great answer for you, but this sounds like a 3rd party issue (Babel/Browserify/?). We really try to keep these forums focused on GSAP-specific questions. We'd love to help if you've got one of those.

 

I'd definitely recommend making sure you've got the latest versions of the various packages. 

  • Like 1
Gean Franco Volpe
Posted

Yes, it was a 3rd party issue, that was the problem, i was using an older version of babelify. Thank you for your time! :D

  • Thanks 1

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...