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

Plz check after build, remoteEntry Path #660

Open
bunzzeok opened this issue Jan 3, 2025 · 10 comments
Open

Plz check after build, remoteEntry Path #660

bunzzeok opened this issue Jan 3, 2025 · 10 comments

Comments

@bunzzeok
Copy link

bunzzeok commented Jan 3, 2025

Versions

  • vite-plugin-federation: 1.3.6
  • vite: 5.1.3

Reproduction

this is my code.

import { fileURLToPath, URL } from "node:url";
import path from "path";
import { defineConfig } from "vite";
import vue from "@vitejs/plugin-vue";
import federation from "@originjs/vite-plugin-federation";
import topLevelAwait from "vite-plugin-top-level-await";

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [
    vue(),
    federation({
      name: "onebite",
      filename: "remoteEntry.js",
      exposes: {
        
        "./todayOneSentence/index": "./src/components/todayOneSentence/index.vue",
      },
      shared: ["vue"],
    }),
    topLevelAwait({
      // The export name of top-level await promise for each chunk module
      promiseExportName: "__tla",
      // The function to generate import names of top-level await promise in each chunk module
      promiseImportName: (i) => `__tla_${i}`,
    }),
  ],
  resolve: {
    alias: {
      "@": path.join(__dirname, "src/"),
      //'@': fileURLToPath(new URL('src', import.meta.url)),
    },
  },
  build: {
    modulePreload: false,
    target: "esnext",
    minify: false,
    cssCodeSplit: false,
    assetsInlineLimit: 1024000, //1M
  },
});

when i build, remoteEntry file path not correct.

            return __federation_import('./assets/__federation_expose_TodayOneSentenceIndex-B5BIPCbQ.js').then((module)=>Object.keys(module).every((item)=>exportSet.has(item)) ? ()=>module.default : ()=>module);
        },

The correct route is ./__federation_expose... , but it is ./assets/__federation_expose.
That's why our service doesn't work normally.

plz check this bug.

Steps to reproduce

  1. npm i
  2. npm run build
  3. show remoteEntry file.

What is Expected?

bug.

What is actually happening?

That's why our service doesn't work normally.

@bunzzeok bunzzeok changed the title plz check after build, remoteEntry Path Plz check after build, remoteEntry Path Jan 3, 2025
@JayeshBaviskar07
Copy link

exactly the same is happening with our microfrontends,
getting wrong path:
The correct route is ./__federation_expose... , but it is ./assets/__federation_expose.

@masud-orangetoolz
Copy link

Same.
This happen to us also... we are currently stuck in this face
the dynamic moduleMap now
return __federation_import("./assets/__federation_expose_Component

before it was
return __federation_import("./__federation_expose_Component

@bunzzeok
Copy link
Author

bunzzeok commented Jan 7, 2025

vite version : 6.0.7
vite-plugin-federation: 1.3.6

@masud-orangetoolz
@JayeshBaviskar07

It will be solved by changing the version first.
However, if this problem happens again, I think I'll get a headache.

@hjhj97
Copy link

hjhj97 commented Jan 7, 2025

Same problem here.

vite : 5.4.10
vite-plugin-federation : 1.3.7

So I downgrade version to 1.3.6 and it works properly

@ttyS0e
Copy link

ttyS0e commented Jan 7, 2025

This commit 352f20e (1.3.7 release) has broken most applications based on this.

It doesn't seem to do what it says - in fact it now ignores the assetsDir completely...

@elyasaf755
Copy link

elyasaf755 commented Jan 9, 2025

We have the same issue in 1.3.7 as well. We reverted to 1.3.6 until it's fixed.
I can't access this commit, but by looking at the name I suspect it might be the cause for this:
The remoteEntryChunk should use the base path from the Vite config. (352f20e)

@PetarDimitrov91
Copy link

The same issue here... Is anyone working on it?

@khamperl
Copy link

Today i Updated and running on the exact same issue. Problem appears for me by update from 1.2.2 to 1.3.7

@lopreiatodaniele
Copy link

Ran into the same issue updating to version >1.3.6, it looks like '/assets' is added to the path.
Is there any workaround besides sticking to 1.3.5?

@bunzzeok
Copy link
Author

Ran into the same issue updating to version >1.3.6, it looks like '/assets' is added to the path. Is there any workaround besides sticking to 1.3.5?

use 1.3.8 !

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

9 participants