Bug Tracker

Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#14561 closed bug (notabug)

Don't set window.jQuery and window.$ when inside a commonjs environment

Reported by: niklas@… Owned by:
Priority: undecided Milestone: None
Component: unfiled Version: 2.1.0-beta2
Keywords: Cc:
Blocked by: Blocking:

Description

If I try to bundle jquery as a dependency inside a redistributable standalone library with browserify I can't have my library polluting the global window namespace with my version of jQuery.

Please (re-)introduce behavior where window.jQuery and window.$ are only set if _not_ in a commonjs environment. This was the case at least for 1.10.2 but not anymore in 2.x.

Change History (3)

comment:1 Changed 6 years ago by niklas@…

If someone needs these globals for some plugin or such, they can trivially do var jquery = window.jQuery = window.$ = require('jquery');

comment:2 Changed 6 years ago by timmywil

Resolution: notabug
Status: newclosed

The variables are exposed in CommonJS for the sake of browser emulators, as is the case when jQuery is included with Node. However, we have been planning to add a build option to remove this exposure from jQuery (whether for the sake of CommonJS or AMD inclusion). Follow up in this ticket: #13566

comment:3 Changed 6 years ago by timmywil

Sorry, I linked the same ticket twice. Follow up in this ticket: http://bugs.jquery.com/ticket/14016

Note: See TracTickets for help on using tickets.