Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vite-based plugin for Hawtio #729

Open
iMashtak opened this issue Dec 30, 2023 · 2 comments
Open

Vite-based plugin for Hawtio #729

iMashtak opened this issue Dec 30, 2023 · 2 comments
Labels
area/plugin-enablement kind/enhancement Enhancements that don't necessarily result in a new feature

Comments

@iMashtak
Copy link

Is anyone tried to use Vite to build plugin for Hawtio? I failed with an error:

Uncaught SyntaxError: Cannot use import statement outside a module

vite.config.js:

import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import federation from "@originjs/vite-plugin-federation";

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [
    react(),
    federation({
      name: "project",
      filename: "remoteEntry.js",
      exposes: {
        "./plugin": "./src/project-plugin",
      },
      shared: ["react"],
    }),
  ],
  build: {
    modulePreload: false,
    target: "esnext",
    minify: false,
    cssCodeSplit: false,
  },
})

I've found the exact line where error occures: core.ts. I thought that module federation do not depend on build tool, but i am certanly not sure:(


CRACO build lasts over 3 minutes on my machine compared to 30 sec with Vite, so i very interested in Vite:)

@tadayosi
Copy link
Member

Hi @iMashtak,

Yes we've tried Vite before hawtio/hawtio-online/issues/147 but what we found hard was that the core depends on @module-federation/utilities which is tied to Webpack implementation of Module Federation, so it's hard to interoperate with Vite at this moment.

Btw, we'll soon throw away CRACO and use plain Webpack instead. In the future, when we can find a way to interoperate with both Webpack and Vite we'll support both.

@tadayosi tadayosi added area/plugin-enablement kind/enhancement Enhancements that don't necessarily result in a new feature labels Dec 30, 2023
@tadayosi
Copy link
Member

For reference: module-federation/core#784

@tadayosi tadayosi added this to the Future milestone Jan 15, 2024
@lhein lhein removed this from the Future milestone Apr 25, 2024
@tadayosi tadayosi modified the milestone: Future May 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/plugin-enablement kind/enhancement Enhancements that don't necessarily result in a new feature
Projects
Status: Backlog
Development

No branches or pull requests

3 participants