-
Notifications
You must be signed in to change notification settings - Fork 293
Open
Description
Versions
- vite-plugin-federation: 1.2.1
- vite: 4.1.0
Reproduction
vite.config.ts
import react from "@vitejs/plugin-react";
import federation from "@originjs/vite-plugin-federation";
// https://vitejs.dev/config/
export default defineConfig({
build: {
lib: {
name: "myContent",
entry: "src/test.js",
formats: ["iife"],
},
},
plugins: [
react(),
federation({
name: "my_app",
filename: "remoteEntry.js",
exposes: {
page: "./src/test.js",
},
}),
],
});
src/test.js
const test = () => {
return "sdfsdfdsf";
};
console.log("hello world");
export default test;
Additional Details
Steps to reproduce
npm run build
What is Expected?
to generate a remoteEntry.js with a global var name myContent, and all the chunks (in case i have).
is it possible to get the same bundle behaviour such as the webpack generates?
i.e:
webpack ModuleFederationPlugin bundle example:
var my_remote_app;
(()=>{
"use strict";
var e, a, t, r, d, c, f, n, o, l, s, i, u, b, h, m, p, v, g = {
446489: (e,a,t)=>{
var r = {
page: ()=>Promise.all([t.e(2370), t.e(6788), t.e(7157), t.e(2716), t.e(2633), t.e(7574), t.e(3222), t.e(2052), t.e(497), t.e(427), t.e(6202), t.e(4370), t.e(7630), t.e(4230), t.e(2897), t.e(4184), t.e(6881), t.e(1729), t.e(8436), t.e(2126), t.e(5344), t.e(1203), t.e(1015), t.e(6519), t.e(7517), t.e(7352), t.e(5071), t.e(7184), t.e(1696), t.e(6225), t.e(8115), t.e(3434), t.e(2850), t.e(6611), t.e(8494)]).then((()=>()=>t(368494)))
}
, d = (e,a)=>(t.R = a,
a = t.o(r, e) ? r[e]() : Promise.resolve().then((()=>{
throw new Error('Module "' + e + '" does not exist in container.')
}
)),
t.R = void 0,
a)
p.s:
is it possible to use iife format and global var name with chunks?
What is actually happening?
Can i still generate a global variable bundle remoteEntry.js, and still have more than 1 chunk, or anybody else has a workaround for this?
Metadata
Metadata
Assignees
Labels
No labels
