ember.js: [IE11] @tracked property initializer is not applied

In IE11 the property initializers for the @tracked decorator are not applied. The following test succeeds in Chrome, but fails in IE11.

tests/unit/tracked-test.js

import { module, test } from 'qunit';
import { setupTest } from 'ember-qunit';
import { tracked } from '@glimmer/tracking';

module('Unit | @tracked', function(hooks) {
  setupTest(hooks);

  test('it applys the initializer', function(assert) {
    class Subject {
      @tracked
      property = 'foo';
    }

    const subject = new Subject();

    assert.strictEqual(subject.property, 'foo');
  });
});

Reproduction repo here: buschtoens/repro-tracked-ie-error

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 2
  • Comments: 23 (23 by maintainers)

Most upvoted comments

Submitted https://github.com/emberjs/ember.js/pull/18091 to migrate to the WeakMap path.

@buschtoens thanks for your work on this, I just hit this same bug and was able to use your babel plugin as a quick workaround.

It didn’t run out of the box, I ended up copying the whole file out of the unreleased version of @babel/helper-create-class-features-plugin.

Made a Babel transform here: babel-plugin-force-eager-initialization

It’s probably far from perfect, but IE11 works now! 🎉