Files
meteor/packages/non-core/jquery/main.js
Ben Newman 24e02b7411 Avoid bundling jquery twice (#10498)
Although the Meteor jquery package is no long a core package (and thus is
not tied to the Meteor release), it seems like a good idea to nudge folks
towards installing jquery from npm, instead of relying on the very old
version (1.12.1) residing in meteor/packages/non-core/jquery/jquery.js.

Closes #10289.
2019-12-18 13:45:36 -05:00

28 lines
874 B
JavaScript

try {
var jQuery = require("jquery");
} catch (e) {
console.warn([
"The jquery npm package could not be found in your node_modules directory.",
"Please run the following command to install it:",
"",
" meteor npm install jquery",
"",
"If you previously relied on a specific version of jquery, it may be important",
"to install that version; for example:",
"",
" meteor npm install jquery@1.12.1",
"",
].join("\n"));
}
if (jQuery) {
// Provide values for the exported variables of the jquery package.
exports.$ = exports.jQuery = jQuery;
// There's no stopping legacy code from referring to window.$ or
// window.jQuery, so we have to keep defining those properties globally,
// but at least the exports of this package will be reliable.
global.$ = global.$ || jQuery;
global.jQuery = global.jQuery || jQuery;
}