@module-federation/vite 1.19.0 → 1.19.1
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
CHANGED
|
@@ -70,6 +70,10 @@ With **@module-federation/vite**, the process becomes delightfully simple, you w
|
|
|
70
70
|
> This example is with [Vue.js](https://vuejs.org/)</br>
|
|
71
71
|
> The @module-federation/vite configuration remains the same for different frameworks.
|
|
72
72
|
|
|
73
|
+
## Migrating from OriginJS
|
|
74
|
+
|
|
75
|
+
Migrating from `@originjs/vite-plugin-federation` requires an explicit remote-entry format and runtime review, particularly for dynamic remotes, shared dependencies, and mixed bundlers. See the [OriginJS migration guide](./docs/MIGRATING_FROM_ORIGINJS.md) for step-by-step migration and incremental deployment guidance.
|
|
76
|
+
|
|
73
77
|
## Dedicated configuration file
|
|
74
78
|
|
|
75
79
|
You can keep Module Federation options in `module-federation.config.ts`.
|
package/lib/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _ as createModuleFederationError, a as getIsRolldown, b as rebaseImport, c as getPackageNameFromNodeModulePath, d as isNuxtProjectRoot, f as packageNameDecode, g as sharedCacheHelperCode, h as setPackageDetectionCwd, i as getInstalledPackageJson, l as getSharedCacheDescriptor, m as resolveImportPath, o as getPackageDetectionCwd, p as packageNameEncode, r as getInstalledPackageEntry, s as getPackageName, u as hasPackageDependency, v as mfWarn, y as normalizePathForImport } from "./pluginDts-
|
|
1
|
+
import { _ as createModuleFederationError, a as getIsRolldown, b as rebaseImport, c as getPackageNameFromNodeModulePath, d as isNuxtProjectRoot, f as packageNameDecode, g as sharedCacheHelperCode, h as setPackageDetectionCwd, i as getInstalledPackageJson, l as getSharedCacheDescriptor, m as resolveImportPath, o as getPackageDetectionCwd, p as packageNameEncode, r as getInstalledPackageEntry, s as getPackageName, u as hasPackageDependency, v as mfWarn, y as normalizePathForImport } from "./pluginDts-9RTNVO8v.js";
|
|
2
2
|
import { createRequire } from "node:module";
|
|
3
3
|
import * as fs$2 from "fs";
|
|
4
4
|
import { existsSync, readFileSync, realpathSync, statSync, writeFileSync } from "fs";
|
|
@@ -2787,7 +2787,7 @@ const externalSharedProviderSelectionHelperCode = `const __mfSelectExternalShare
|
|
|
2787
2787
|
const candidates = Object.fromEntries(
|
|
2788
2788
|
Object.entries(versions || {}).filter(([, provider]) => !isLocalProvider(provider))
|
|
2789
2789
|
);
|
|
2790
|
-
if (localShare?.version) {
|
|
2790
|
+
if (localShare?.version && localShare.shareConfig?.import !== false) {
|
|
2791
2791
|
const sameVersionProvider = candidates[localShare.version];
|
|
2792
2792
|
// Runtime registration keeps an existing same-version record,
|
|
2793
2793
|
// even when it has only a getter and is not loaded yet. Model
|
|
@@ -8040,6 +8040,7 @@ function createEarlyVirtualModulesPlugin(options) {
|
|
|
8040
8040
|
if (!args.importer || args.namespace === "mf-shared") return;
|
|
8041
8041
|
if (isSharedResolverInternalImporter(args.importer)) return;
|
|
8042
8042
|
if (!findSharedKey(args.path, shared) || isAssetLikeImport(args.path)) return;
|
|
8043
|
+
if (getPackageNameFromNodeModulePath(args.importer) === getPackageName(args.path)) return;
|
|
8043
8044
|
return {
|
|
8044
8045
|
path: args.path,
|
|
8045
8046
|
namespace: "mf-shared"
|
|
@@ -8168,7 +8169,7 @@ function applyBuildTimeRuntimeDefines(define, options, { target, isAstro, defaul
|
|
|
8168
8169
|
}
|
|
8169
8170
|
function loadPluginDts(options) {
|
|
8170
8171
|
if (options.dts === false) return [];
|
|
8171
|
-
return [import("./pluginDts-
|
|
8172
|
+
return [import("./pluginDts-9RTNVO8v.js").then((n) => n.n).then(({ default: pluginDts }) => pluginDts(options))];
|
|
8172
8173
|
}
|
|
8173
8174
|
function federation(mfUserOptions) {
|
|
8174
8175
|
if (isTestEnv()) return [];
|
|
@@ -480,10 +480,10 @@ function getInstalledPackageEntry(pkg, opts) {
|
|
|
480
480
|
if (!installed) return void 0;
|
|
481
481
|
const cwd = opts?.cwd || getPackageDetectionCwd();
|
|
482
482
|
const packageName = opts?.packageName || getPackageName(pkg);
|
|
483
|
-
|
|
483
|
+
const packageJson = installed.packageJson;
|
|
484
|
+
if (pkg !== packageName && (opts?.resolveSubpathWithRequire !== false || packageJson.exports === void 0)) try {
|
|
484
485
|
return createRequire$1(pathToFileURL(path$1.join(cwd, "package.json"))).resolve(pkg);
|
|
485
486
|
} catch {}
|
|
486
|
-
const packageJson = installed.packageJson;
|
|
487
487
|
const explicitEntry = resolveExportsEntry(getPackageExportsTarget(pkg, packageName, packageJson.exports), opts?.conditions) || (typeof packageJson.module === "string" ? packageJson.module : void 0) || (typeof packageJson.main === "string" ? packageJson.main : void 0) || "index.js";
|
|
488
488
|
return path$1.join(installed.dir, explicitEntry);
|
|
489
489
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@module-federation/vite",
|
|
3
|
-
"version": "1.19.
|
|
3
|
+
"version": "1.19.1",
|
|
4
4
|
"description": "Vite plugin for Module Federation",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./lib/index.js",
|
|
@@ -86,4 +86,4 @@
|
|
|
86
86
|
"vite": "8.1.0",
|
|
87
87
|
"vitest": "4.0.18"
|
|
88
88
|
}
|
|
89
|
-
}
|
|
89
|
+
}
|