Skip to content

not compatible with ember 7 #959

@NullVoxPopuli

Description

@NullVoxPopuli

Things that must be resolved before fastboot can be used with ember 7

This patch resolves things for ember 7, but breaks super early versions because import * as name isn't allowed.

diff --git a/addon/locations/none.js b/addon/locations/none.js
index c21f2e9aa7ca7ffb3fe7afd1c004df3ddb6e9709..03f42cfcaf5984aaf66d39f2f207d2652f0eeb09 100644
--- a/addon/locations/none.js
+++ b/addon/locations/none.js
@@ -1,7 +1,8 @@
 /* eslint-disable ember/no-classic-classes, ember/no-get, ember/require-computed-property-dependencies, prettier/prettier */
 import { computed, get } from '@ember/object';
 import { bool, readOnly } from '@ember/object/computed';
-import { inject as service } from '@ember/service';
+import * as serviceModule from '@ember/service';
+const service = serviceModule.service || serviceModule.inject;
 import { getOwner } from '@ember/application'
 import NoneLocation from '@ember/routing/none-location'
 
diff --git a/fastboot/initializers/ajax.js b/fastboot/initializers/ajax.js
index dde8fe616f43b62082a1ba049f936ae7f9036343..c3d78e21b3d5a789223c3b9be348da00853b0bc2 100644
--- a/fastboot/initializers/ajax.js
+++ b/fastboot/initializers/ajax.js
@@ -1,8 +1,6 @@
 /* eslint-disable ember/new-module-imports, prettier/prettier */
 /* globals najax */
-import Ember from 'ember';
-
-const { get } = Ember;
+import { get } from '@ember/object';
 
 var nodeAjax = function(options) {
   let httpRegex = /^https?:\/\//;
diff --git a/fastboot/initializers/error-handler.js b/fastboot/initializers/error-handler.js
index 0d1a697945c03cb1eb7a9b1fc791a11f58e19e9a..4f8330fae68d300c00f4df172532ba9d2a7fae99 100644
--- a/fastboot/initializers/error-handler.js
+++ b/fastboot/initializers/error-handler.js
@@ -1,5 +1,4 @@
 /* eslint-disable prettier/prettier */
-import Ember from 'ember';
 
 /**
  * Initializer to attach an `onError` hook to your app running in fastboot. It catches any run loop
@@ -9,13 +8,5 @@ import Ember from 'ember';
 export default {
   name: 'error-handler',
 
-  initialize: function() {
-    if (!Ember.onerror) {
-      // if no onerror handler is defined, define one for fastboot environments
-      Ember.onerror = function(err) {
-        const errorMessage = `There was an error running your app in fastboot. More info about the error: \n ${err.stack || err}`;
-        console.error(errorMessage);
-      }
-    }
-  }
+  initialize: function() {}
 };

So, I suspect that for ember 7 support to be added, ancient embers will have to be dropped (in ember-auto-import, 3.4 is the failing set of scenarios with fastboot and the above patch).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions