Hi :)
I'm trying to run compiled app on one of the pages of another app that knows nothing about can.js
or steal
or webpack
, so just rendering app in some div.
And I have following issue when add bundle to the page:"Uncaught TypeError: Cannot define property _instanceDefinitions, object is not extensible"
at this line:
https://github.com/canjs/can-define/blob/master/define-helpers/define-helpers.js#L17
After short research I found out that my bundle contains these lines:
https://github.com/canjs/can-define/blob/master/can-define.js#L809
// only seal in dev mode for performance reasons.
//!steal-remove-start
this._data;
this._computed;
if(sealed !== false) {
Object.seal(this);
}
//!steal-remove-end
And as I got this seals object, so later it can't be extended by define-helpers
.
Since I'm building app by Webpack
it leaves this sections because obviously !steal-remove-start
something that only Steal
understands.
I think I can add logic to remove these blocks, but is it safe ? Or is there any other ways to get version without these blocks.
const AppViewModel = DefineMap.extend('AppViewModel', {
appName: {
type: 'string',
serialize: false
},
filter: 'string'
});
const appVM = new AppViewModel({
appName: 'Name'
});
route.data = appVM;
route('{filter}');
route.ready();
document.body.appendChild(view(appVM));
route.data = appVM;
route('{filter}');
route.ready();
https://localhost/something/t/home?param1=value¶m2=value
can.route
doing something that cause this issue
Apache
and using this url everything works fine: https://localhost/something/
param1
and param2
on your AppViewModel
defineExpando
function?
can-route-pushstate
. I used it during development...but If I wan't to open the same app in some popup it is better to use normal can-route
by #!
in this case application URL will work fine.