1

I want to use existing library like GSAP. I am using webpack, though I don't know what is the right way to do this. Should I be using bower to install my packages and injecting them into my index.html where there are the js and css injection points as if I had used grunt? Or should I be npm installing packages?

Rolando
  • 58,640
  • 98
  • 266
  • 407
  • when using a standard import statement, you get the error "document is not defined". Supposedly there is a way to [shim webpack](https://webpack.github.io/docs/shimming-modules.html) or you can [disable AMD loading](http://stackoverflow.com/questions/35531126/how-to-use-scrollmagic-with-gsap-and-webpack) – BishopZ Aug 01 '16 at 21:54

1 Answers1

0

You have to use npm package installation and you have to use like

npm install --save GSAP

it will also update your package.json file.

Dhaval Patel
  • 7,471
  • 6
  • 37
  • 70
  • Is there any reason why I wouldn't want to use bower? Or is the idea that NPM install with webpack replaces all that bower has? I am a little worried as I have libraries like dygraphs for example I know does not have any "ES6" in mind. – Rolando Nov 30 '15 at 05:46
  • yes it has a npm package see https://github.com/danvk/dygraphs/blob/master/package.json – Dhaval Patel Nov 30 '15 at 05:50
  • So if I do that, how does webpack know where to "include" the correct js for either of those libraries? With bower, I can install the package iwth bower install and then wiredep to include the packages. – Rolando Nov 30 '15 at 06:04
  • it's job of webpack it's not depend on npm or bower, webpack takes modules with dependencies and generates static assets representing those modules. – Dhaval Patel Nov 30 '15 at 06:07