Skip to content

Are we using Webpack's Module Federation correctly? #515

@frapell

Description

@frapell

So, as far as I understand, if a bundle imports a module, it is reused when another bundle imports it again... This doesn't appear to be the case...
Take for instance TinyMCE, this is what I see under the "Network" tab in Firefox when editing a mosaic:

image

As can be seen, bundle.min.js pulls a tinymce from its chunks directory, and then plone-mosaic-remote.min.js pulls another one from mosaic's chunks directory. It does the same with the tinymce_plugins chunk.
Furthermore, it can be seen from the "Debugger" tab, that in fact a bunch of other patterns are re-imported from the @plone/mockup package from Mosaic's node_modules, when it should be reusing the ones already imported from Mockup...

image

Another example, select2

image

Mosaic has @plone/mockup pinned to be 5.0.0-beta.7, which is the latest and the same one used in plone.staticresources so all versions should be the same. Furthermore, I used yarn link to link to the same mockup pulled from source, and this same behavior is observed.

I believe there's something wrong in the way webpack module federation is being used, but I cannot figure it out... I see in the devtools console
Patternslib Module Federation: Loaded and initialized bundle "__patternslib_mf__plonemosaic". shouldn't I be seeing the same for mockup ?

@thet If you can shed some light here, that would be greatly appreciated :) (And in case it hasn't been merged yet, you can use this branch #514)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions