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

FastBoot is not defined from Browser Console #69

Open
majew7 opened this issue Sep 7, 2017 · 1 comment
Open

FastBoot is not defined from Browser Console #69

majew7 opened this issue Sep 7, 2017 · 1 comment

Comments

@majew7
Copy link

majew7 commented Sep 7, 2017

I see the following error in my browser console:

Error in Component#send ReferenceError: FastBoot is not defined

Though this cannot be correct, as our Ember Application is NOT FastBoot enabled.

Culprit?
Also in Chrome Dev Tools - Sources I see a file named: fastboot-fetch.js

(function() {
  define('fetch', ['exports'], function(self) {
    var fetch = FastBoot.require('node-fetch');
    self['default'] = fetch;
    self['Headers'] = fetch.Headers;
    self['Request'] = fetch.Request;
    self['Response'] = fetch.Response;
  });

  define('fetch/ajax', ['exports'], function() {
    throw new Error('You included `fetch/ajax` but it was renamed to `ember-fetch/ajax`');
  });
})();

Our Context
We have not explicitly installed this ember-fetch package. Rather ember-fetch is a dependency upon ember-simple-auth, which we have explicitly npm installed.

We are using Ember Engines with lazyLoading enabled.

Similar Issue
The GitHub Repo ember-cli-moment-shim had a similar issue:
Issue: jasonmit/ember-cli-moment-shim#145
Fix: jasonmit/ember-cli-moment-shim@591ae7a

@jasonmit
Copy link
Contributor

jasonmit commented Jul 24, 2018

I also ran into this using ember-fetch. Here is my current work around.

Warning: not public API by any means and very likely will break in the future

// my-engine/index.js
module.exports = EngineAddon.extend({
  name: 'my-engine',

  lazyLoading: {
    enabled: true
  },

  included() {
    this._super.included.apply(this, arguments);

    const engines = this.project.findAddonByName('ember-engines');
    engines.manifestOptions.filesToIgnore.push(/\/fastboot-fetch.js$/);
  },

  isDevelopingAddon() {
    return true;
  }
})

The true fix is likely ember-engines/ember-engines#490 (comment) but some discussion needs to happen before that can be resolved. Specifically around how the options are provided to ember-engines from the app engine(s).

Edit: Reproduction of the issue https://github.com/jasonmit/x-lazy-app/

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

2 participants