question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Load a library globally to a project after using yarn add

See original GitHub issue

Hello, What’s the proper way to load a library (GSAP & scrollmagic in my case) after adding them using yarn add 'libraryName'. I managed to import Jquery by using provide in task-config.js, still, I’m not sure what’s the proper way to import a different library including its plugins. An example would be greatly appreciated. Thanks

Issue Analytics

  • State:open
  • Created 6 years ago
  • Reactions:2
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
york-xtremcommented, Jan 14, 2018

Fixed up!

Solution: Disable AMD

npm i imports-loader
import {TweenMax, TimelineMax} from "gsap";
import ScrollMagic from "scrollmagic";
import 'imports-loader?define=>false!scrollmagic/scrollmagic/uncompressed/plugins/animation.gsap';

More info: https://github.com/webpack-contrib/imports-loader, https://webpack.js.org/loaders/imports-loader/#webpack-config-js and https://github.com/janpaepke/ScrollMagic/issues/665#issuecomment-323344772

Disable AMD

There are many modules that check for a define function before using CommonJS. Since webpack is capable of both, they default to AMD in this case, which can be a problem if the implementation is quirky.

Then you can easily disable the AMD path by writing

imports-loader?define=>false
1reaction
york-xtremcommented, Oct 18, 2017

@farissi Did you get it to work? I’ve been going crazy for a week and nothing…

Read more comments on GitHub >

github_iconTop Results From Across the Web

yarn global
Note: Unlike the --global flag in npm, global is a command which must immediately follow yarn . Entering yarn add global package-name will...
Read more >
How To Install and Use the Yarn Package Manager for Node.js
First you install the yarn command globally, then you use the global yarn command to install a specific local version of Yarn into...
Read more >
How to install a list of many global packages with Yarn
Make sure that you already have Node installed on your system. Using this above command the yarn packages can be installed globally. Note...
Read more >
How to use local Node packages as project dependencies
There are npm add relative/path and yarn add file:relative/path , which copy the package directory over to the project's node_modules. The npm ...
Read more >
Extending with Shared Libraries - Jenkins
Since these libraries will be globally usable, any Pipeline in the system can utilize ... would load a library using the same SCM...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found