I am developing multiple plugins to a system that loads these plugins as AMD modules (with requirejs). Plugins are written as ES6 modules and packed with webpack (output.libraryTarget = 'amd'). Everything works as expected so far.
But plugins share quite a lot of common code that is bundled into every entry. I tried to use CommonsChunkPlugin
webpack plugin but initial chunk contains code that is not AMD module. However other entry points relaying on common chuck are still generated correctly. Also documentation says that it is not good idea to have multiple initial chunks (with JSONp runtime) on one page - there is possibility that another plugin author would use same approach.
Is there a way to optimize this use case in AMD compatible manner?
It seems to me as a bug in CommonsChunkPlugin
that the initial entry is not AMD (but still its code is not safe to be loaded in plugin env)... Is there a configuration I am missing?