These are chat archives for canjs/canjs

21st
May 2018
Viktor Busko
@Lighttree
May 21 2018 08:06
@pYr0x regarding can-view-autorender it doesn't work with webpack:
here is tries to 'load' module
https://github.com/canjs/can-view-autorender/blob/master/can-view-autorender.js#L78
and inside it resolves to undefined:
https://github.com/canjs/can-util/blob/master/js/import/import.js#L44
Due to this everything fails here:
https://github.com/canjs/can-view-autorender/blob/master/can-view-autorender.js#L79
with
Uncaught (in promise) TypeError: Cannot read property 'async' of undefined
Viktor Busko
@Lighttree
May 21 2018 08:21
Its seems... that it should be resolved to stache but not sure how it is expected to be resolved.
For example if I add here:
https://github.com/canjs/can-view-autorender/blob/master/can-view-autorender.js#L79
if (!engine) {
        engine = require('can-stache');
}
it works
Viktor Busko
@Lighttree
May 21 2018 08:45
@justinbmeyer hey, could you check above. Is it valid case to rise a bug ? Maybe you know how to workaround this ?
It is in can3
Chasen Le Hara
@chasenlehara
May 21 2018 16:42
@Lighttree I think you’ll want to use can-view-autorender@3.1.4 instead of the latest version (master has a 5.x prerelease right now).
can-view-autorender 3.x uses can-util/js/import/import for that same code you pointed out: https://github.com/canjs/can-view-autorender/blob/c50b46838ef4d5b61e688063743144f04b4be361/can-view-autorender.js#L4
So please feel free to file another one if those don’t cover the same issue, and we’d happily accept a PR that makes it work with webpack :D
Viktor Busko
@Lighttree
May 21 2018 20:59
@chasenlehara Ok, thx. Regarding PR. My solution is quite straightforward, but I'm not sure that importing can-stache in can-view-autorender is correct there. Since there is abstract engine used. So maybe there is smarter way to fix this.
Chasen Le Hara
@chasenlehara
May 21 2018 21:09
Yeah, adding a direct dependency to can-stache would be wrong, the right way would be to fix can-util/js/import / can-module-import to work with webpack
I don’t know enough about webpack to point you in the right direction… but maybe just an import() statement would work? https://webpack.js.org/api/module-methods/#import-