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.

Importing using ES6 but jQuery is loaded externally

See original GitHub issue

Ok so my situation is a bit sticky. I am developing a WordPress theme for a client, but I am using ES6 with Babel and Browserify for my custom code. Problem is I cant just deregister jQuery because the majority of WP plugins require it. So in every ES6 module I just const $ = window.jQuery (because I just couldn’t make browserify shim to work properly). But now when I import 'jquery-circle-progress' I jsut get that circleProgress is not a function of jQuery. Any suggestions how I should proceed ? At this point I just added the whole plugin into my Libraries JS stack, and its available everywhere, but that’s not cool.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
andreiglingeanucommented, Dec 15, 2016

@dobromir-hristov I fixed that problem by marking jquery module as a global variable that comes from window.jQuery, like that. I am using webpack, though. I bet browserify have such an option too.

0reactions
kottenatorcommented, Jan 9, 2017

jquery-circle-progress@1.2.1 released.

Now few words about browserify-shim configuration: see my gist.

I believe the bug is fixed. I’m closing this ticket. @dobromir-hristov - please, check if everything works now. Feel free to reopen this ticket.

Read more comments on GitHub >

github_iconTop Results From Across the Web

'jQuery is not defined' when use ES6 import - Stack Overflow
According to this comment and apply it to your case, when you're doing: import $ from 'jquery' import jQuery from 'jquery'.
Read more >
How to include a JavaScript file in another JavaScript file?
Let's start by using the ES6 way of importing and exporting. Create a file named utils.js and define the following function and constant...
Read more >
How to Load External JavaScript Files From the Browser ...
Here is how to import JavaScript without a <script> tag directly from ... But what if you want to just load the external...
Read more >
How to Include a JavaScript File in Another JavaScript File
jQuery Loading. Loading with jQuery can be done by just one line: .getScript("script.js", ...
Read more >
How to Check if jQuery Is Loaded on a Page Using JavaScript
The CodeSandbox above has jQuery loaded as a dependency and imports it using ES6 syntax with the import keyword.
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