-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Working example with webpack #665
Comments
Where would you import that? Do you have a project example/template that I could take a look at? |
Thanks for this, you saved the day! Using angular-cli I had to add the imports-loader: https://github.com/webpack-contrib/imports-loader and use |
I got it working with webpack 2 by providing aliases.
Then simply import the module like you normally would.
or
|
OK OK, that was a headache. See #665 (comment) In webpack 3, inside of {
test: require.resolve('scrollmagic/scrollmagic/uncompressed/plugins/jquery.ScrollMagic.js'),
loader: 'imports-loader?define=>false'
}, {
test: require.resolve('scrollmagic/scrollmagic/uncompressed/plugins/debug.addIndicators.js'),
loader: 'imports-loader?define=>false'
} More info: https://github.com/webpack-contrib/imports-loader#disable-amd Using Also note I use resolve: {
modules: [
path.resolve(__dirname), path.resolve(__dirname, "node_modules")
]
} |
Any luck with the animation.gsap plugin? Using webpack 3 I got everything to work but the plugin automatically includes TweenMax and TimelineMax when all I need are the lite versions. I think it may be related to how the plugin was originally written. Just curious if you encountered that or if you have an example in a repo somewhere of your implementation. Thanks, |
@tomshaw Maybe webpack 3 specific, but needed to change |
@ryanwiemer If you loock in animation.gsap.js:31 you will see it defines |
@Sandstedt gotcha. Thanks for the help. Yeah I realized for what I was doing I needed the "max" versions anyways. Not a big deal. I'm no webpack expert but here is the link to my repo in case anyone wanted to see how I implemented it: https://github.com/ryanwiemer/doggo Also the link to the website if interested: https://www.doggoforhire.com/ Thanks, |
Anyone succesfully imported only what he needs with webpack (and typescript) ?
Now how to import ScrollMagic + animation.gsap without having TweenMax.js comes into the bundle (just go away TweenMax) ? |
Finally got it working with resolve alias and :
What a pain that was, but I got rid of TweenMax.js |
I made it work in local using @tomshaw's solution but every time I want to build it I have this error:
If I use @of6's solution, it doesn't work locally. I have this error:
Any idea on how to solve this issue? Am I doing something wrong? |
worked for me on "imports-loader": "^0.8.0", |
How would you do that in a vue-cli setup? I tried the imports-loader thing, copied the code from @thanosasimo but get an error |
my setup is like this
Did you install scrollmagic and imports-loader?
|
following this, I'm exactly in the same position as @cdedreuille |
this setup works for Webpack 4, #324 (comment) |
Thanks a lot!! |
I used this package here is what my file looks like
|
@audetcameron your solution works perfect for me, Thanks! |
@audetcameron Thanks for the solution, I guess that package used this answer code |
If you want to work with debug.addIndicators.js or animation.gsap you have to add also TimelineMax and TimelineLite cause they have dependencies. So I recommend adding all of these aliases:
And then import in your component what you need, for example:
|
Only working solution for me with webpack. |
For people in the future reading this: This solution works with react without ejecting! |
Hi All, After escalating this issue for 1 month I guess I found great solution.
Before:
After:
Before:
After:
I hope this solution will work for you. |
forked scroll-magic repo and modified animation file to exclude root …
This doesn't work for GSAP 3...
|
There is a current fix being made #920 referenced here epranka/scrollmagic-plugin-gsap#5 |
Using https://www.npmjs.com/package/scrollmagic-plugin-gsap totally saved my day. import ScrollMagic from 'scrollmagic'
import { TweenMax, TimelineMax, Linear } from 'gsap'
import 'imports-loader?define=>false!scrollmagic/scrollmagic/uncompressed/plugins/debug.addIndicators'
import { ScrollMagicPluginGsap } from "scrollmagic-plugin-gsap";
ScrollMagicPluginGsap(ScrollMagic, TweenMax, TimelineMax); |
If you're coming here from the future, just add this to your webpack config: {
test: new RegExp("scrollmagic/scrollmagic/uncompressed"),
use: [
{
loader: "imports-loader",
options: {
additionalCode:
"var define = false; /* Disable AMD for misbehaving libraries */",
}
}
]
}, |
I was able to finally get this working with webpack if anyone else is trying to do the same:
package.json
then to import
The text was updated successfully, but these errors were encountered: