Dist build breaks application?


Ember 2.6.0

I have an application that works fine when built and run in development mode. When I do a product build (ember build -p) it breaks.

The error I get is: “vendor-dd06bb4….js:30 Uncaught TypeError: Cannot read property ‘allowNull’ of undefined” If I look in the debugger, it appears to be complaining about boolean transforms.

The back-end connection is exactly the same when I run the ember app (that is ED is connecting to the same exact back-end when I run in develop vs. the built version).

Is this a known issue?


Are you trying to use the allowNull option for ember-data boolean attributes? If so, that isn’t available until 2.7.0, which might be causing problems. Although I’m not sure why your development build would work yet…


Nope. I tried adding it to see if that fixed it because I saw that documentation, but no go. But the error is indicating that the thing it’s trying to read allowNull on is itself undefined, not that it doesn’t have allowNull.

define("ember-data/-private/transforms/boolean", ["exports", "ember", "ember-data/transform", "ember-data/-private/features"], function(e, t, r, n) {
"use strict";
var i = t.default.isNone;
e.default = r.default.extend({
    deserialize: function(e, t) {
        var r = typeof e;
        return i(e) && t.allowNull === !0 ? null : "boolean" === r ? e : "string" === r ? null !== e.match(/^true$|^t$|^1$/i) : "number" === r && 1 === e
    serialize: function(e, t) {
        return i(e) && t.allowNull === !0 ? null : Boolean(e) <-- this is where it's complaining



You think I should open a ticket? I’m hesitant to do so since I wouldn’t even know how to begin to create a re-creatable test scenario to demonstrate the problem :frowning:



@bmac on Slack pointed me towards the problem.

My devDependencies in package.json had ember-data as ^2.5.0 where as my bower.json had ember at 2.6.0. For some reason, this only made it an issue when building production versions. Hard setting the devDependency to ember-data: 2.6.0 worked.