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

najax not present when using jQuery in v0.4/v0.5 #471

Open
runspired opened this issue May 20, 2021 · 1 comment
Open

najax not present when using jQuery in v0.4/v0.5 #471

runspired opened this issue May 20, 2021 · 1 comment

Comments

@runspired
Copy link

runspired commented May 20, 2021

I'm trying to update ember-data's fastboot tests from v0.2. v0.3 works fine.

Starting in 0.4 however @ember/jquery seems to fail to correctly import jquery into the vendor shim and thus no jQuery global is present. No other dependencies are being changed and our fastboot version, ember-source version, and @ember/jquery is the latest release in all cases.

I haven't been able to determine what changed between 0.3 and 0.4 to trigger this (there are very few changes that aren't dependency changes), but wanted to surface this here in case anyone using jQuery still bumps into an error telling them they need to install ember-fetch after upgrading to 0.4 or 0.5.

Edit: after looking through the codepaths it seems the jQuery global check was a red herring, it's always false in fastboot. When using jQuery najax needs to be installed, this used to be brought by fastboot itself but that support was changed in 3.x which v0.4 here bumped to (a deprecation would have been nice, but oh well). The solution here was to install the beta of ember-cli-fastboot 3.x, the latest fastboot, the latest najax, and to configure config/fastboot-testing.js

module.exports = {
  resilient: true,
  buildSandboxGlobals(defaultGlobals) {
    const additionalGlobals = {};
    try {
      const najax = require('najax'); // eslint-disable-line
      additionalGlobals.najax = najax;
    } catch (e) {
      // we only add the global if najax is installed
    }
    return Object.assign({}, defaultGlobals, additionalGlobals);
  },
};
@runspired
Copy link
Author

I've traced this down to #328 from @thoov which bumped this to bring a version of fastboot (3.x) that isn't actually available via any version of ember-cli-fastboot (which uses fastboot 2.x). It seems the ember-fastboot project has failed to release a new version of ember-cli-fastboot in quite a long time.

While the jQuery issue isn't with this repo, I'd suggest downgrading fastboot to 2.x to match what users can actually install.

@runspired runspired changed the title Jquery global not present in v0.4/v0.5 najax not present when using jQuery in v0.4/v0.5 May 20, 2021
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