Deprecations Added in Ember CLI 2.x

What follows is a list of deprecations introduced to Ember CLI during the 2.x cycle.

For more information on deprecations in Ember CLI, see the main deprecations page.

Deprecations Added in 2.0.0

§ Migrate from Brocfile.js to ember-cli-build.js

until: 3.0.0
id: migrate-from-brocfile-js-to-ember-cli-build-js

Early versions of Ember CLI utilized the default build file of Broccoli: Brocfile.js. Over time we began realizing that this was not a tenable solution (we could not pass high fidelity objects into the build pipeline, and therefore created two instances of all addons, etc), and introduced a replacement for Brocfile.js: ember-cli-build.js. The new structure allows Ember CLI to pass information into the function exported by ember-cli-build.js and avoid the issues mentioned above.

The migration from Brocfile.js to ember-cli-build.js is fairly straight forward:

Migrate Brocfile.js from:

// Brocfile.js
var EmberApp = require('ember-cli/lib/broccoli/ember-app');
var app = new EmberApp();
module.exports = app.toTree();

To ember-cli-build.js:

var EmberApp = require('ember-cli/lib/broccoli/ember-app');

module.exports = function(defaults) {
  var app = new EmberApp(defaults, {
      // Any options
  });

  return app.toTree();
};

Deprecations Added in 2.2.0

§ Deprecate Utility

until: 3.0.0
id: deprecate-utility

Using the ember-cli/lib/utlities/deprecate module to issue deprecations has been deprecated in favor of using .writeDeprecateLine method on the ui object (which is available on both addons and project instances).

Migrate from:

const deprecate = require('ember-cli/lib/utilities/deprecate');

module.exports = {
  name: 'my-addon-name',

  someMethod() {
    deprecate('this thing is deprecated!');
  }
}

To:

module.exports = {
  name: 'my-addon-name',

  someMethod() {
    this.ui.writeDeprecateLine('this thing is deprecated!');
  }
}

Deprecations Added in 2.7.0

§ Base URL

until: 3.0.0
id: base-url

The usage of baseURL setting in config/environments.js has been deprecated in favor of using an explicit rootURL. A detailed explanation of the problem and the migration path can be found in this blog post.

Migration for pre-2.7 applications is:

  1. Update config/environment.js to remove reference to baseURL and update to rootURL.
  2. Update app/index.html to add {{rootURL}} a the beginning of all assets that are loaded.
  3. Update the app/router.js to pass rootURL to the subclass of Ember.Router being created.

More detailed descriptions of this migration can be found on the blog: here

Deprecations Added in 2.12.0

§ Clobbering Addon#options

until:
id: clobbering-addon-options

Clobbering this.options within an addon has been deprecated. If you would like to use this.options for internal options within your addon, you must preserve the intitial options object that is present.

Instead of doing this:

included() {
  this.options = { my-addons: { special: { options: 'here' } } };
}

You should do the following:

included() {
  this.options = this.options || {};
  this.options['my-addons'] = { special: { options: 'here' } };
}