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
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
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
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:
- Update
config/environment.js
to remove reference tobaseURL
and update torootURL
. - Update
app/index.html
to add{{rootURL}}
a the beginning of all assets that are loaded. - Update the
app/router.js
to passrootURL
to the subclass ofEmber.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
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' } };
}