Importing using ES6 but jQuery is loaded externally
See original GitHub issueOk 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:
- Created 7 years ago
- Comments:7 (7 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@dobromir-hristov I fixed that problem by marking
jquery
module as a global variable that comes fromwindow.jQuery
, like that. I am using webpack, though. I bet browserify have such an option too.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.