Skip to content

Unable to destructure Ember.Object after update to 2.13 #7004

@jrjohnson

Description

@jrjohnson

The following code no longer works in ember-cli 2.13:

const { Object } = Ember;

This will build just fine, but It fails at runtime with the error:

Cannot read property 'defineProperty' of undefined

I created an example repo with this issue https://github.com/jrjohnson/destructured-object-example

ember new destructured-example
ember g controller application

The only thing necessary to trigger the error is putting any attempt to destructure Object from Ember into your application code, in the example I put it in the application controller.

This may turn out to be a duplicate of #7001 as they present similar errors.

Transpiled output:

define('destructure-object/controllers/application', ['exports', 'ember'], function (exports, _ember) {
  'use strict';

  Object.defineProperty(exports, "__esModule", {
    value: true
  });
  var Object = _ember.default.Object;
  exports.default = _ember.default.Controller.extend({});
});

Output from ember version --verbose && npm --version && yarn --version:

ember-cli: 2.13.0
http_parser: 2.7.0
node: 7.8.0
v8: 5.5.372.43
uv: 1.11.0
zlib: 1.2.11
ares: 1.10.1-DEV
modules: 51
openssl: 1.0.2k
icu: 58.2
unicode: 9.0
cldr: 30.0.3
tz: 2016j
os: darwin x64
4.2.0
0.23.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions