prateekbh / babel-esm-plugin

Add this plugin to generate mirrored esm modules for your existing bundles
MIT License
192 stars 16 forks source link

child compiler's assets does not have `webpackJsonpCallback` function #5

Closed prateekbh closed 6 years ago

prateekbh commented 6 years ago

Any assets created by babel-esm-plugin does not have webpackJsonpCallback to load the respective chucks.

prateekbh commented 6 years ago

@ev1stensberg @developit any ideas?

evenstensberg commented 6 years ago

Could you give a code example if you have one?

prateekbh commented 6 years ago

@ev1stensberg Sure, Here I create a childCompiler: https://github.com/prateekbh/babel-esm-plugin/blob/master/src/index.js#L25

then I loop over every entry point and add them via SingleEntryPlugin https://github.com/prateekbh/babel-esm-plugin/blob/master/src/index.js#L27-L29

This generates the bundles and chunks as expected. But, the bundles generated does not have

screen shot 2018-05-30 at 8 06 20 am

e.g. es5 bundles generated without this plugin say(index.js) will have this but the mirrored bundle (index.es6.js) will not have the same.

Is this the expected functionality: https://github.com/webpack/docs/wiki/internal-webpack-plugins#singleentryplugincontext-request-chunkname???

If yes, is there a plugin which can actually include this code?

evenstensberg commented 6 years ago

I don't really know to be honest. @TheLarkInn might have some input on that.

prateekbh commented 6 years ago

I fixed this by adding https://github.com/prateekbh/babel-esm-plugin/blob/master/src/index.js#L40