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

Support CommonJS/UMD modules in dev mode #20

Closed
echjordan0 opened this issue Nov 21, 2023 · 1 comment
Closed

Support CommonJS/UMD modules in dev mode #20

echjordan0 opened this issue Nov 21, 2023 · 1 comment

Comments

@echjordan0
Copy link

Hello and thank you again for this plugin.
We spoke a bit in this issue and I am working on implementing the plugin for both host and remote (no webpack). Everything seems to work quite well with vite build and vite preview but I am unable to use vite dev mode (vite). It seems that once I add the plugin, pre-bundling of Common JS/UMD to ESM, which as I understand it is standard behavior for Vite, no longer happens? Or is happening incorrectly?
I understand I could alias to the ESM distribution for dev mode but we are still on Vue 2 and have some older packages that do not distribute an ESM version of the module so we would be blocked from using the plugin by this issue.

Relevant packages:
"vue": "2.7.14",
"@module-federation/vite": "^0.2.8",
"@softarc/native-federation": "^2.0.4",
"@softarc/native-federation-esbuild": "^2.0.4",
"@vitejs/plugin-vue2": "1.1.2",

Host config

    await federation({
      options: {
        workspaceRoot: __dirname,
        outputPath: 'dist',
        tsConfig: 'tsconfig.json',
        federationConfig: 'federation.config.ts',
        verbose: true,
        dev: command === 'serve',
      },
      adapter: createEsBuildAdapter({ plugins: [] }),
    }),

Remote config

    await federation({
      options: {
        workspaceRoot: __dirname,
        outputPath: 'dist',
        tsConfig: 'tsconfig.json',
        federationConfig: 'federation.config.ts',
        verbose: true,
        dev: command === 'serve',
      },
      adapter: createEsBuildAdapter({
        plugins: [pluginVue()],
      }),
    }),

Example error for package with no esm distribution:
Screenshot 2023-11-21 at 12 32 35 PM

@gioboa
Copy link
Collaborator

gioboa commented Aug 16, 2024

We are working on a new version of this package in this PR
I'm closing this issue, if you want, you can try the new version and give us feedback. Thanks.

@gioboa gioboa closed this as completed Aug 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants