Search code examples
herokuember.jsember-clienvironment

Ember-CLI app deployed to heroku with environment=production loses global app namespace


My app name is App and I have access to the App namespace when environment=developing. Only problem is that issues arise when I use the production version by running (ember server --environment=production, then I no longer have access to the App namespace as it is undefined.

Error while processing route: coming-soon App is not defined ReferenceError: App is not defined

Is this a security measure ember-cli takes? How can I override this?


Solution

  • Ember-cli comes with the addon ember-export-application-global. By default it doesn't export the app name to the global scope in production environment.
    You can override this behavior by adding in config/environment.js :

    //config/environment.js
    module.exports = function(environment) {
      var ENV = {
        //...
        //...
        exportApplicationGlobal: true
          //...
          //...
      }
    
      //...
      //...
    };