emberjs/ember-jquery

Ember 3.4.6 w/ @ember/jquery bundles jquery twice

offirgolan opened this issue ยท 8 comments

After doing an ember upgrade to 3.4.6, the blueprint added @ember/jquery as a dependency. After booting, I noticed a lot of strange behaviors (window.jQuery === undefined but window.$ was set correctly). Looking at the vendor.js, I noticed two exact copies of jquery were bundled. The current solve right now is to just remove @ember/jquery and use the one bundled with ember-soource.

@offirgolan what is your version of Ember/ember-cli? Do you have @ember/optional-features installed and the jquery-integration feature flag turned on?

ember-source: 3.4.6
ember-cli: 3.4.3
@ember/optional-features: 0.7.0

// config/optional-features.json
{
  "jquery-integration": true
}

We are in a monorepo so that could be a cause?

@offirgolan this was an issue with ember-cli-page-object.

san650/ember-cli-page-object@007e817#diff-168726dbe96b3ce427e7fedce31bb0bc resolves this.

Awesome, thanks for the detective work!

Interesting.... thanks for resolving this @jasonmit. I dont think that ember-cli-page-object should be bundling jquery at all, but instead throwing an error that jquery is not available and letting the end user handle that ๐Ÿคทโ€โ™‚๏ธ

I dont think that ember-cli-page-object should be bundling jquery at all, but instead throwing an error that jquery is not available and letting the end user handle that

IIRC e-c-p-o relies on jQuery internally (e.g. on :eq() support for their collections API), and their solution to supporting native events, the new testing APIs and jquery-less apps was to bundle jQuery, but use it only internally, and not expose it at the usual global entrypoints ($, jQuery, Ember.$)...

and their solution to supporting native events, the new testing APIs and jquery-less apps was to bundle jQuery, but use it only internally.

Ah, that makes a lot of sense. Thanks for the context @simonihmig ๐Ÿ™‚.

This discussion took a while for me to stumble upon, but fixed the same issue for me. Thanks!