kottenator / kottenator/jquery-circle-progress
Conflict With Other Libraries (Waypoints) when loading with RequireJs, Loads jquery twice
- Dominant language
- JavaScript
- Stars
- 1.1k
- Forks
- 300
- PR merge metrics
- No merged PRs in 30d
Description
Hi
I had an issue where jQuery was loading twice on the page because while defining your AMD module you have taken 'jQuery' as a dependency. I think instead of including it there it should only be a part of the documentation. This is what was happening in my case.
1. I included jQuery globally because I was using bootstrap and also wanted to load jQuery in the global scope and not via RequireJs.
2. Since in AMD it has been defined as a dependency even RequireJs was loading jQuery and it was loading twice on the page.
3. I included Waypoints jQuery plugin which stopped working because of jQuery being included twice on the page.
Just to resolve this temporarily I have used the following configuration in require.config
```javascript
require.config({
baseUrl: "/assets/js",
paths: {
circleProgress:'circle-progress',
jqueryWaypoints: 'jquery.waypoints',
},
shim: {
jqueryWaypoints: {
deps: ['circleProgress']
}
}
});
```
then in my module I have defined the module like this
```javascript
define(['jqueryWaypoints'], function (){}
```
This does away with the error for now but jQuery still loads twice on the page where the module is being loaded. Let me know if you can think of an elegant solution to this.
Thanks!
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reviewing the AMD dependency declaration described in the issue and reproduce the setup with RequireJS, global jQuery, and Waypoints. Verify how the plugin is loaded and whether jQuery is requested twice; done means the page loads one jQuery instance and Waypoints continues to work.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, jquery
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100