steal-tools icon indicating copy to clipboard operation
steal-tools copied to clipboard

slim loader not working properly with canJS 5, ES modules and multimain

Open pYr0x opened this issue 6 years ago • 5 comments

i give the slim loader a try and want to use it in my multimain app, we had an issue with multimain #823 and @m-mujica solved it.

but now i have a more complex app and it the slim-loader breaks.

the problem are shared dependencies.

i created an example app.

  • https://github.com/pYr0x/slim-multimain/tree/working : a simple dependency called "_shared.js" is used in both mains. after build it works like expected
  • https://github.com/pYr0x/slim-multimain/tree/not-working : same principle, but now i added canjs5 to it. in _shared.js i import import {ajax} from "can"; and in second main i import import {DefineMap} from "can";. the apps breaks. main1.js:107 Uncaught (in promise) TypeError: Cannot read property 'call' of undefined . Moduls 6 is not in modulesMap.

it would be nice if this problem will be solved. slim loader runs as twice as fast as steal.

pYr0x avatar Jul 28 '18 16:07 pYr0x

Yeah, I'll see if I can fix this today.

matthewp avatar Jul 30 '18 14:07 matthewp

There's a couple of bugs here at least:

  • Setting treeShaking: false in the BuildOptions does not turn off the client-side tree-shaking. @pYr0x as a stop-gap you can add "treeShaking": false in your package.json steal config and it will disable it in both places, and this will work.
  • The tree-shaking is removing a module, can/core I believe. Looking into why.

matthewp avatar Jul 31 '18 13:07 matthewp

https://github.com/stealjs/steal-tools/issues/1058 <- First bug.

matthewp avatar Jul 31 '18 14:07 matthewp

@matthewp any idea when the second bug will be fixed?

pYr0x avatar Sep 26 '18 11:09 pYr0x

I must have forgotten about this. I'll add it to my sprint

matthewp avatar Sep 26 '18 11:09 matthewp