@module-federation/vite 1.16.4 → 1.16.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +21 -8
- package/lib/{index.d.cts → index.d.ts} +9 -1
- package/lib/{index.mjs → index.js} +518 -394
- package/lib/{packageUtils-Bbc6r6__.mjs → packageUtils-CYnJFfPP.js} +77 -23
- package/lib/{pluginDts-DDx4TPN8.mjs → pluginDts-BaVhdR6i.js} +4 -4
- package/lib/utils/{ssrEntryLoader.mjs → ssrEntryLoader.js} +3 -3
- package/package.json +14 -24
- package/lib/index.cjs +0 -5381
- package/lib/index.d.mts +0 -167
- package/lib/packageUtils-se-UDhCa.cjs +0 -367
- package/lib/pluginDts-7EoFboCu.cjs +0 -311
- package/lib/utils/ssrEntryLoader.cjs +0 -301
- package/lib/utils/ssrEntryLoader.d.cts +0 -65
- /package/lib/utils/{ssrEntryLoader.d.mts → ssrEntryLoader.d.ts} +0 -0
package/README.md
CHANGED
|
@@ -59,22 +59,22 @@ With **@module-federation/vite**, the process becomes delightfully simple, you w
|
|
|
59
59
|
You can keep Module Federation options in `module-federation.config.ts`.
|
|
60
60
|
|
|
61
61
|
```ts
|
|
62
|
-
import { createModuleFederationConfig } from
|
|
62
|
+
import { createModuleFederationConfig } from "@module-federation/vite";
|
|
63
63
|
|
|
64
64
|
export default createModuleFederationConfig({
|
|
65
|
-
name:
|
|
66
|
-
filename:
|
|
65
|
+
name: "remote",
|
|
66
|
+
filename: "remoteEntry.js",
|
|
67
67
|
exposes: {
|
|
68
|
-
|
|
68
|
+
"./remote-app": "./src/App.vue",
|
|
69
69
|
},
|
|
70
|
-
shared: [
|
|
70
|
+
shared: ["vue"],
|
|
71
71
|
});
|
|
72
72
|
```
|
|
73
73
|
|
|
74
74
|
```ts
|
|
75
|
-
import { defineConfig } from
|
|
76
|
-
import { federation } from
|
|
77
|
-
import moduleFederationConfig from
|
|
75
|
+
import { defineConfig } from "vite";
|
|
76
|
+
import { federation } from "@module-federation/vite";
|
|
77
|
+
import moduleFederationConfig from "./module-federation.config";
|
|
78
78
|
|
|
79
79
|
export default defineConfig({
|
|
80
80
|
plugins: [federation(moduleFederationConfig)],
|
|
@@ -175,6 +175,19 @@ export default defineConfig({
|
|
|
175
175
|
// It also disables the preload-helper patch used for remotes.
|
|
176
176
|
// In serve for consumer-only apps, this defaults to true unless explicitly set.
|
|
177
177
|
disableAssetsAnalyze: false,
|
|
178
|
+
// Optional hook to mutate generated manifest/stats data.
|
|
179
|
+
additionalData: ({ stats }) => {
|
|
180
|
+
stats.metaData.deployEnv = process.env.NODE_ENV;
|
|
181
|
+
stats.metaData.region = "eu";
|
|
182
|
+
stats.custom = {
|
|
183
|
+
buildId: process.env.BUILD_ID,
|
|
184
|
+
};
|
|
185
|
+
},
|
|
186
|
+
// Or return a replacement/merged object.
|
|
187
|
+
// additionalData: ({ stats }) => ({
|
|
188
|
+
// ...stats,
|
|
189
|
+
// custom: { buildId: process.env.BUILD_ID },
|
|
190
|
+
// }),
|
|
178
191
|
},
|
|
179
192
|
}),
|
|
180
193
|
],
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ShareStrategy } from "@module-federation/runtime/types";
|
|
2
1
|
import { moduleFederationPlugin } from "@module-federation/sdk";
|
|
2
|
+
import { ShareStrategy } from "@module-federation/runtime/types";
|
|
3
3
|
|
|
4
4
|
//#region src/utils/normalizeModuleFederationOptions.d.ts
|
|
5
5
|
interface RemoteObjectConfig {
|
|
@@ -14,6 +14,14 @@ interface PluginManifestOptions {
|
|
|
14
14
|
filePath?: string;
|
|
15
15
|
disableAssetsAnalyze?: boolean;
|
|
16
16
|
fileName?: string;
|
|
17
|
+
additionalData?: (options: {
|
|
18
|
+
stats: Record<string, unknown>;
|
|
19
|
+
manifest?: Record<string, unknown>;
|
|
20
|
+
pluginOptions: Record<string, unknown>;
|
|
21
|
+
compiler?: unknown;
|
|
22
|
+
compilation?: unknown;
|
|
23
|
+
bundler: 'vite';
|
|
24
|
+
}) => Promise<Record<string, unknown> | void> | Record<string, unknown> | void;
|
|
17
25
|
}
|
|
18
26
|
type ModuleFederationOptions = {
|
|
19
27
|
exposes?: Record<string, string | {
|