@module-federation/vite 1.15.3 → 1.15.4

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/lib/index.cjs CHANGED
@@ -1168,10 +1168,14 @@ function writePreBuildLibPath(pkg, shareItem) {
1168
1168
  }
1169
1169
  const namedExports = getPackageNamedExports(pkg);
1170
1170
  if (namedExports.length > 0) {
1171
+ const namedExportVars = namedExports.map((_name, i) => `__mf_${i}`);
1172
+ const declarations = namedExports.map((name, i) => `const ${namedExportVars[i]} = __mfPrebuildExports[${escapeGeneratedStringLiteral(name)}];`).join("\n ");
1173
+ const namedExportLine = `export { ${namedExports.map((name, i) => `${namedExportVars[i]} as ${name}`).join(", ")} };`;
1171
1174
  preBuildCacheMap[pkg].writeSync(`
1172
1175
  import * as __mfPrebuildNamespace from ${escapeGeneratedStringLiteral(importSource)};
1173
1176
  const __mfPrebuildExports = __mfPrebuildNamespace;
1174
- ${namedExports.map((name) => `export const ${name} = __mfPrebuildExports[${escapeGeneratedStringLiteral(name)}];`).join("\n ")}
1177
+ ${declarations}
1178
+ ${namedExportLine}
1175
1179
  export default __mfPrebuildExports;
1176
1180
  `, true);
1177
1181
  return;
package/lib/index.mjs CHANGED
@@ -1148,10 +1148,14 @@ function writePreBuildLibPath(pkg, shareItem) {
1148
1148
  }
1149
1149
  const namedExports = getPackageNamedExports(pkg);
1150
1150
  if (namedExports.length > 0) {
1151
+ const namedExportVars = namedExports.map((_name, i) => `__mf_${i}`);
1152
+ const declarations = namedExports.map((name, i) => `const ${namedExportVars[i]} = __mfPrebuildExports[${escapeGeneratedStringLiteral(name)}];`).join("\n ");
1153
+ const namedExportLine = `export { ${namedExports.map((name, i) => `${namedExportVars[i]} as ${name}`).join(", ")} };`;
1151
1154
  preBuildCacheMap[pkg].writeSync(`
1152
1155
  import * as __mfPrebuildNamespace from ${escapeGeneratedStringLiteral(importSource)};
1153
1156
  const __mfPrebuildExports = __mfPrebuildNamespace;
1154
- ${namedExports.map((name) => `export const ${name} = __mfPrebuildExports[${escapeGeneratedStringLiteral(name)}];`).join("\n ")}
1157
+ ${declarations}
1158
+ ${namedExportLine}
1155
1159
  export default __mfPrebuildExports;
1156
1160
  `, true);
1157
1161
  return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@module-federation/vite",
3
- "version": "1.15.3",
3
+ "version": "1.15.4",
4
4
  "description": "Vite plugin for Module Federation",
5
5
  "type": "module",
6
6
  "main": "./lib/index.cjs",