-
Notifications
You must be signed in to change notification settings - Fork 8.2k
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
DEV: remove @ember/jquery in favor of just jquery #24034
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -81,6 +81,11 @@ module.exports = function (defaults) { | |
}, | ||
}); | ||
|
||
// TODO: remove me | ||
// Ember 3.28 still has some internal dependency on jQuery being a global, | ||
// for the time being we will bring it in vendor.js | ||
app.import("node_modules/jquery/dist/jquery.js", { prepend: true }); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Once we stop doing this, one difference will be that, when evaluated as a "real-ish" module, jQuery detects that and does not define the Currently on 3.28 that is not very feasible as the ember internals gets loaded before our initializer runs and expects the global to be defined. Once we are on 4+, that problem goes away. When we are in control of adding the |
||
|
||
// WARNING: We should only import scripts here if they are not in NPM. | ||
app.import(vendorJs + "bootbox.js"); | ||
app.import("node_modules/ember-source/dist/ember-template-compiler.js", { | ||
|
@@ -154,7 +159,9 @@ module.exports = function (defaults) { | |
function ({ request }, callback) { | ||
if ( | ||
!request.includes("-embroider-implicit") && | ||
(request.startsWith("admin/") || | ||
// TODO: delete special case for jquery when removing app.import() above | ||
(request === "jquery" || | ||
request.startsWith("admin/") || | ||
request.startsWith("wizard/") || | ||
(request.startsWith("pretty-text/engines/") && | ||
request !== "pretty-text/engines/discourse-markdown-it") || | ||
|
@@ -173,6 +180,22 @@ module.exports = function (defaults) { | |
exportsPresence: "error", | ||
}, | ||
}, | ||
rules: [ | ||
{ | ||
test: require.resolve("bootstrap/js/modal"), | ||
use: [ | ||
{ | ||
loader: "imports-loader", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
options: { | ||
imports: { | ||
moduleName: "jquery", | ||
name: "jQuery", | ||
}, | ||
}, | ||
}, | ||
], | ||
}, | ||
], | ||
}, | ||
}, | ||
}, | ||
|
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't do anything right now/yet, since
ember-source@3.28
also brings a shim for this (loadShim
checks forrequire.has
and no-op)It'll be needed once we upgrade
ember-source