|
3 | 3 | if (typeof FastBoot === 'undefined') { |
4 | 4 | var current = document.getElementById('fastboot-body-start'); |
5 | 5 |
|
6 | | - var _Ember = require.has('ember') ? require('ember').default : window.Ember; |
7 | | - var _ViewUtils = require.has('@ember/-internals/views') ? require('@ember/-internals/views') : _Ember.ViewUtils; |
| 6 | + if (!current) { |
| 7 | + return; |
| 8 | + } |
| 9 | + |
| 10 | + var isSerializationFirstNode; |
| 11 | + var ApplicationInstance; |
| 12 | + |
| 13 | + if (require.has('@ember/-internals/glimmer') && require.has('@ember/application/instance')) { |
| 14 | + isSerializationFirstNode = require('@ember/-internals/glimmer').isSerializationFirstNode; |
| 15 | + ApplicationInstance = require('@ember/application/instance').default; |
| 16 | + } else if (require.has('ember')) { |
| 17 | + var _Ember = require('ember').default; |
| 18 | + isSerializationFirstNode = _Ember.ViewUtils.isSerializationFirstNode; |
| 19 | + ApplicationInstance = _Ember.ApplicationInstance; |
| 20 | + } else if (window.Ember) { |
| 21 | + isSerializationFirstNode = window.Ember.ViewUtils.isSerializationFirstNode; |
| 22 | + ApplicationInstance = window.Ember.ApplicationInstance; |
| 23 | + } |
8 | 24 |
|
9 | | - if (current && !_Ember) { |
| 25 | + if (!isSerializationFirstNode || !ApplicationInstance) { |
10 | 26 | console.error(`Experimental render mode rehydrate isn't working because it couldn't find Ember via AMD or global. |
11 | 27 | See https://github.com/ember-fastboot/ember-cli-fastboot/issues/938 for the current state of the fix.`); |
12 | 28 | return; |
13 | 29 | } |
14 | 30 |
|
15 | 31 | if ( |
16 | | - current && |
17 | | - typeof _ViewUtils.isSerializationFirstNode === 'function' && |
18 | | - _ViewUtils.isSerializationFirstNode(current.nextSibling) |
| 32 | + typeof isSerializationFirstNode === 'function' && |
| 33 | + isSerializationFirstNode(current.nextSibling) |
19 | 34 | ) { |
20 | | - _Ember.ApplicationInstance.reopen({ |
| 35 | + ApplicationInstance.reopen({ |
21 | 36 | _bootSync: function(options) { |
22 | 37 | if (options === undefined) { |
23 | 38 | options = { |
|
0 commit comments