Jump to content
Search Community

Import ModifiersPlugin Webpack

tsimenis test
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

Hi everyone, 

 

I am using the modifiers plugin alongside other gsap plugins. 

During development everything works fine but when I build my project I get this error:

 

invalid modifiers tween value: [object Object]

 

This is how I am importing the plugin:

 

import {TweenLite, TweenMax, Linear} from 'gsap'
import '@/assets/vendor/ThrowPropsPlugin'
import Draggable from 'gsap/Draggable'
import 'gsap/ModifiersPlugin'

 

Any help would be appreciated

 

 

Link to comment
Share on other sites

Hi,

 

Without more info about other libraries/frameworks you're using, my guess is that you're using webpack or a CLI that uses webpack for the build process. So perhaps this has to do with tree shaking:

 

https://greensock.com/docs/NPMUsage

 

Scroll down a bit and you'll find the tree shaking part.

 

If this doesn't help, please provide more details about what you're doing, your setup and perhaps a reduced live sample or a setup file to take a look in our local environments for testing.

 

Happy Tweening!!

  • Like 5
Link to comment
Share on other sites

Hi @Rodrigo,

 

thank you for your reply, I am using Vuejs and the project is created with Vue CLI 3 (webpack).

 

You are actually right, it seems it has to do with tree shaking, I didn't think of it since I didn't have this issue before.

 

So I got it working with two ways, the important part seems to be to reference the plugin in your code

 

import Draggable from 'gsap/Draggable'
import '@/assets/vendor/ThrowPropsPlugin'
import ModifiersPlugin from 'gsap/ModifiersPlugin'
import {TweenLite, TweenMax, Linear} from 'gsap'

//or according to the docs
import '@/assets/vendor/ThrowPropsPlugin'
import {TweenLite, TweenMax, Linear, ModifiersPlugin, Draggable} from 'gsap/all'


// mounted hook
const plugins = [ModifiersPlugin]

 

It feels it's not the prettiest solution but I guess it's the only one

 

thanks a lot for your help!

 

 

  • Like 2
  • Thanks 2
Link to comment
Share on other sites

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...