psimoneau22 / microfrontend-plugin

dynamically load react components for a plugin or microfront-end architechture
11 stars 1 forks source link

Feedback #1

Open jgaehring opened 5 years ago

jgaehring commented 5 years ago

Greetings!

I found your repo via https://github.com/webpack/webpack/issues/7526#issuecomment-503489232. Your link to the article on martinfowler.com was very helpful to me in implementing my own microfrontend architecture in Vue.js: https://github.com/farmOS/farmOS-client/pull/216. It's for an open source farming application I'm working on that has a backend written in Drupal. We've been looking for a way to make the frontend mirror the module-based system that Drupal uses, and I think this could be the ticket. One change I've made to the architecture in the Fowler article is to get the src URL's for the script tags from the server itself, so the container app doesn't have any knowledge of them whatsoever. It looks like you're doing something similar in DynamicPluginConnected.js, correct?

I haven't had a chance to really dive deep into your code, but if you're still looking for feedback, I wouldn't mind taking a closer look. Perhaps we could trade notes.

Anyways, thanks for the inspiration, deeply appreciated!

psimoneau22 commented 5 years ago

yes, that is what my project does also. The DynamicPlugin component is just passed the id of the plugin. The plugin server builds out a manifest for the urls for all the plugins/subapps that looks like this:

[ {id: "com.exampleDomain.plugin1, url: "https:/...(url to public js file) }, ...etc ]

the DynamicPlugin component fetchess that json/manifest file, and loads the correct url. The user can just enter in the name of the plugin you want to load (in the textbox), and it adds the script with the src attribute pointing to the corresponding 'src' attribute

jgaehring commented 5 years ago

The user can just enter in the name of the plugin you want to load (in the textbox), and it adds the script with the src attribute pointing to the corresponding 'src' attribute

Oh that's cool! We're planning to wrap each plugin in a Drupal module, so then the admin can install them and enable the plugin like any other Drupal module. Sort of similar, although our setup poses some challenges to the dev environment, which I haven't quite worked out yet.

My feeling is that perhaps the greatest benefit of the microfrontend architecture is this kind of plugin functionality, wherein the user can customize the interface and feature-set to suit their needs.