Open phantomjinx opened 1 year ago
@phantomjinx thanks for the investigation. One thing I noticed during my experiment with Vite is that the @module-federation/utilities
module that we use for the dynamic plugin mechanism in @hawtio/react
seems to only work with Webpack plugin for Module Federation. Since Vite uses a different plugin than Webpack's ModuleFederationPlugin, if we want to migrate to Vite we'd need to update @hawtio/react
as well.
Btw, your branch doesn't seem to use a right plugin for Module Federation. You can find examples for how to use MF with Vite here: https://github.com/module-federation/module-federation-examples/tree/master/vite-react-microfrontends What we need to use should be this plugn: https://github.com/module-federation/vite and modfiy this part in a way that it supports dynamic module loading for the Vite plugin: https://github.com/hawtio/hawtio-next/blob/6a799e25a35f68391793bbbfadb72fbeecc8e80d/packages/hawtio/src/core/core.ts#L148-L180
Thinking of it a bit further, I feel it's not healthy that the core part of @hawtio/react
depends so much on a build tool (i.e. Webpack, Vite, etc.) and we need to modify the core whenever we just want to switch the build tool we use at the last stage of the frontend console assembly. I wonder if we can come up with an abstraction at @hawtio/react
so that we can easily switch the build tools or even support multiple ones (Webpack or Vite) by users' preferences.
Again, thinking of it a bit further, what's most important now should be compatibility with OpenShift dynamic plugins because we want hawtio-online to be deployed as a dynamic plugin on OpenShift eventually. So, we need to make sure the technology we choose works well with OpenShift dynamic plugins, and in this regard keeping Webpack module federation might be the best bet for now.
Transition of
kubernetes-api-app
package to vite build system produces errors when both executing the dev server and serving a full build. This might suggest a couple of extra properties need defining in the config file or could be something more fundamental.See experimental branch here -> https://github.com/hawtio/hawtio-online/tree/experiment-vite/packages/kubernetes-api-app
yarn start
yarn build && yarn serve