Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conflict With Other Libraries (Waypoints) when loading with RequireJs, Loads jquery twice #200

Open
manikbajaj opened this issue Jul 15, 2019 · 0 comments

Comments

@manikbajaj
Copy link

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

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

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant