0

Loading a page produces the following error: steal.js:140 Potentially unhandled rejection [1] TypeError: Cannot define property _instanceDefinitions, object is not extensible at Function.defineProperty (<anonymous>) at Object.defineExpando (http://localhost:8080/node_modules/can-define/define-helpers/define-helpers.js:20:11) at DefineMap.setKeyValue (http://localhost:8080/node_modules/can-define/map/map.js:52:30) at Object.setKeyValue (http://localhost:8080/node_modules/can-reflect/reflections/get-set/get-set.js:50:23) at Object.eval (http://localhost:8080/node_modules/can-reflect/reflections/shape/shape.js:701:23) at String.eval (http://localhost:8080/node_modules/can-reflect/reflections/shape/shape.js:445:21) at Object.eachListLike (http://localhost:8080/node_modules/can-reflect/reflections/shape/shape.js:376:17) at Object.eachIndex (http://localhost:8080/node_modules/can-reflect/reflections/shape/shape.js:338:16) at Object.eachKey (http://localhost:8080/node_modules/can-reflect/reflections/shape/shape.js:443:16) at Object.assignDeepMap (http://localhost:8080/node_modules/can-reflect/reflections/shape/shape.js:698:8) Hot realoding does not work anymore. This seems to come from steal.js and i have no idea how this is related to my code. Could it be that this problem is happening in a worker thread...?

Here my package.json: ... "dependencies": { "can-ajax": "^1.1.4", "can-component": "^3.3.10", "can-connect": "^1.5.9", "can-define": "^1.5.5", "can-route": "^3.2.3", "can-route-pushstate": "^3.1.2", "can-set": "^1.3.2", "can-stache": "^3.11.1", "can-view-autorender": "^3.1.1", "can-zone": "^0.6.13", "done-autorender": "^1.4.0", "done-component": "^1.0.0", "done-css": "^3.0.1", "done-serve": "^1.5.0", "generator-donejs": "^1.0.7", "lodash": "^4.17.5", "steal": "^1.5.15", "steal-less": "^1.2.0", "steal-stache": "^3.1.2" }, "devDependencies": { "can-fixture": "^1.1.1", "donejs-cli": "^1.0.0", "funcunit": "^3.2.0", "steal-qunit": "^1.0.1", "steal-tools": "^1.9.1", "testee": "^0.3.0" } ... Node:

node --version v8.9.2 npm --version 5.5.1

OS: ver Microsoft Windows [Version 10.0.15063]

Oscar
  • 59
  • 1
  • 5
  • The problem is that something is trying to set a property on a sealed object. This is difficult to debug without seeing your code. Is there a way you could share your code? – Ryan Wheale Feb 09 '18 at 03:35
  • Hi Ryan, here the code: https://github.com/indianscout/app THX – Oscar Feb 11 '18 at 11:12

1 Answers1

1

As a short term solution, try adding { seal: false } to your app viewmodel:

const AppViewModel = DefineMap.extend({ seal: false }, {
    title: {
        value: 'spotwizard.org',
        serialize: false
    }
});

Update: after further testing, you are trying to set the "page" property on your app viewmodel, but you did not define one. Your app viewmodel should look like this:

const AppViewModel = DefineMap.extend({
    title: {
        value: 'spotwizard.org',
        serialize: false
    },
    page: 'string'
});
Ryan Wheale
  • 26,022
  • 8
  • 76
  • 96
  • Yes, you are right, the route prop itself... I did not realize that. Great! Thank you very much! – Oscar Feb 12 '18 at 20:14
  • 1
    And just so you know, the error you reported has been fixed in later versions of `can-define`: https://github.com/canjs/can-define/issues/309 – Ryan Wheale Feb 12 '18 at 21:03
  • Yes, good to know. I actually did not know where the problem is coming from. I was searching through the stealjs issues but did not find anything similar. THX for helping. Regards – Oscar Feb 13 '18 at 19:56