Ember application runtime error uncaught referenceerror ember is not defined vendor.js

148 Views Asked by At

I'm trying to upgrade the ember from 3.* to 4.12.2. I'm not getting any compilation issues but when I run my application I'm getting "uncaught referenceerror ember is not defined" inside the vendor.js file.

below is the console log in browser.

vendor.js?v=95293905-3319-4db8-8355-c1297659dfa6:98  Uncaught ReferenceError: Ember is not defined
    at a.callback (vendor.js?v=95293905-3319-4db8-8355-c1297659dfa6:98:389464)
    at a.exports (vendor.js?v=95293905-3319-4db8-8355-c1297659dfa6:1:2153)
    at a._reify (vendor.js?v=95293905-3319-4db8-8355-c1297659dfa6:1:2747)
    at a.reify (vendor.js?v=95293905-3319-4db8-8355-c1297659dfa6:1:2532)
    at a.exports (vendor.js?v=95293905-3319-4db8-8355-c1297659dfa6:1:2125)
    at a._reify (vendor.js?v=95293905-3319-4db8-8355-c1297659dfa6:1:2747)
    at a.reify (vendor.js?v=95293905-3319-4db8-8355-c1297659dfa6:1:2532)
    at a.exports (vendor.js?v=95293905-3319-4db8-8355-c1297659dfa6:1:2125)
    at a._reify (vendor.js?v=95293905-3319-4db8-8355-c1297659dfa6:1:2747)
    at a.reify (vendor.js?v=95293905-3319-4db8-8355-c1297659dfa6:1:2532)

enter image description here

Any help appreciated, Thank you in advance.

Regards

I tried removing deprecated libraries, tried using auto import still getting this same issue

1

There are 1 best solutions below

1
NullVoxPopuli On BEST ANSWER

In Ember v4 using Ember without importing it was removed. This was deprecated in v3.

enter image description here

Your screenshot of the problem area was most helpful -- it reveals that ember-islands/utils/reconciler needs to have import Ember from ember` in it. It seems like the latest version has that import, so hunch is now that something is going wrong with the polyfill included here: https://github.com/mitchlloyd/ember-islands/blob/master/package.json#L23-L24

To unblock your upgrade, I would use patch-package or npm/yarn/pnpm overrides to update the dependencies of the library -- it looks like it's had no maintenance in the last 4-5 years, so if you want to continue using it -- you may need to fork (this has the advantage, where you can also make the addon do whatever you want).