ember.jsnpmember-clibroccolijs

ember-cli fails on --environment=production (Uncaught Error: Could not find module)


I am using ember-cli and have a problem with selecting the production environment. Specifically, everything works when I run ember serve --environment=development and I get a blank page when I run ember serve --environment=production. In the console, I see:

All other things are equal, and all dependencies are up to date. I'm a total noob so I don't even know where to begin on how to debug: is it ember? ember-cli? broccoli? Any help would be appreciated.


Solution

  • Solution is mentioned on Ember CLI website:

    This is somewhat non-standard and discouraged, but suppose that due to a requirement in your application that you need to use the full version of Handlebars even in the production environment.

    Basically, you can pass vendorFiles option to your EmberApp instance which will force CLI to include full version of Handlebars.

    Example of explicitly requiring handlebars.js , in Brocfile.js:

    var app = new EmberApp({
      vendorFiles: {
        'handlebars.js': {
          production: 'bower_components/handlebars/handlebars.js'
        }
      }
    });
    

    This is recommended way of solving this issue(discussion on GitHub).