@module-federation/vite 1.1.1 → 1.1.2

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
@@ -15,6 +15,10 @@ This plugin makes Module Federation work together with [Vite](https://vitejs.dev
15
15
 
16
16
  ### [React](https://github.com/gioboa/react-microfrontend-demo)<br>
17
17
 
18
+ ### [Svelte](https://github.com/gioboa/svelte-microfrontend-demo)<br>
19
+
20
+ ### [SolidJS](https://github.com/gioboa/solid-microfrontend-demo)<br>
21
+
18
22
  ### [More examples here](https://github.com/module-federation/vite/tree/main/examples)<br>
19
23
 
20
24
  ## Try this crazy example with all these bundlers together
package/lib/index.cjs CHANGED
@@ -980,13 +980,13 @@ function pluginModuleParseEnd (excludeFn) {
980
980
  apply: 'build',
981
981
  moduleParsed: function moduleParsed(module) {
982
982
  var id = module.id;
983
- if (excludeFn(id)) {
984
- return;
985
- }
986
983
  if (id === VIRTUAL_EXPOSES) {
987
984
  // When the entry JS file is empty and only contains exposes export code, it’s necessary to wait for the exposes modules to be resolved in order to collect the dependencies being used.
988
985
  exposesParseEnd = true;
989
986
  }
987
+ if (excludeFn(id)) {
988
+ return;
989
+ }
990
990
  parseEndSet.add(id);
991
991
  if (exposesParseEnd && parseStartSet.size === parseEndSet.size) {
992
992
  _resolve(1);
@@ -1250,14 +1250,14 @@ function federation(mfUserOptions) {
1250
1250
  entryName: 'virtualExposes',
1251
1251
  entryPath: VIRTUAL_EXPOSES
1252
1252
  }), [pluginProxyRemoteEntry(), pluginProxyRemotes(options)], pluginModuleParseEnd(function (id) {
1253
- return id.includes(getHostAutoInitImportId()) || id.includes(REMOTE_ENTRY_ID) || id.includes(getLocalSharedImportMapPath());
1253
+ return id.includes(getHostAutoInitImportId()) || id.includes(REMOTE_ENTRY_ID) || id.includes(VIRTUAL_EXPOSES) || id.includes(getLocalSharedImportMapPath());
1254
1254
  }), proxySharedModule({
1255
1255
  shared: shared
1256
1256
  }), [PluginDevProxyModuleTopLevelAwait(), {
1257
1257
  name: 'module-federation-vite',
1258
1258
  enforce: 'post',
1259
1259
  config: function config(_config, _ref) {
1260
- var _config$optimizeDeps, _config$optimizeDeps2, _config$optimizeDeps3;
1260
+ var _config$optimizeDeps, _config$optimizeDeps2, _config$optimizeDeps3, _config$optimizeDeps4;
1261
1261
  // TODO: singleton
1262
1262
  _config.resolve.alias.push({
1263
1263
  find: '@module-federation/runtime',
@@ -1266,6 +1266,7 @@ function federation(mfUserOptions) {
1266
1266
  (_config$optimizeDeps = _config.optimizeDeps) == null || (_config$optimizeDeps = _config$optimizeDeps.include) == null || _config$optimizeDeps.push('@module-federation/runtime');
1267
1267
  (_config$optimizeDeps2 = _config.optimizeDeps) == null || (_config$optimizeDeps2 = _config$optimizeDeps2.include) == null || _config$optimizeDeps2.push('__mf__virtual');
1268
1268
  (_config$optimizeDeps3 = _config.optimizeDeps) == null || (_config$optimizeDeps3 = _config$optimizeDeps3.needsInterop) == null || _config$optimizeDeps3.push('__mf__virtual');
1269
+ (_config$optimizeDeps4 = _config.optimizeDeps) == null || (_config$optimizeDeps4 = _config$optimizeDeps4.needsInterop) == null || _config$optimizeDeps4.push(getLocalSharedImportMapPath());
1269
1270
  }
1270
1271
  }], Manifest());
1271
1272
  }
package/lib/index.esm.js CHANGED
@@ -957,13 +957,13 @@ function pluginModuleParseEnd (excludeFn) {
957
957
  apply: 'build',
958
958
  moduleParsed: function moduleParsed(module) {
959
959
  var id = module.id;
960
- if (excludeFn(id)) {
961
- return;
962
- }
963
960
  if (id === VIRTUAL_EXPOSES) {
964
961
  // When the entry JS file is empty and only contains exposes export code, it’s necessary to wait for the exposes modules to be resolved in order to collect the dependencies being used.
965
962
  exposesParseEnd = true;
966
963
  }
964
+ if (excludeFn(id)) {
965
+ return;
966
+ }
967
967
  parseEndSet.add(id);
968
968
  if (exposesParseEnd && parseStartSet.size === parseEndSet.size) {
969
969
  _resolve(1);
@@ -1227,14 +1227,14 @@ function federation(mfUserOptions) {
1227
1227
  entryName: 'virtualExposes',
1228
1228
  entryPath: VIRTUAL_EXPOSES
1229
1229
  }), [pluginProxyRemoteEntry(), pluginProxyRemotes(options)], pluginModuleParseEnd(function (id) {
1230
- return id.includes(getHostAutoInitImportId()) || id.includes(REMOTE_ENTRY_ID) || id.includes(getLocalSharedImportMapPath());
1230
+ return id.includes(getHostAutoInitImportId()) || id.includes(REMOTE_ENTRY_ID) || id.includes(VIRTUAL_EXPOSES) || id.includes(getLocalSharedImportMapPath());
1231
1231
  }), proxySharedModule({
1232
1232
  shared: shared
1233
1233
  }), [PluginDevProxyModuleTopLevelAwait(), {
1234
1234
  name: 'module-federation-vite',
1235
1235
  enforce: 'post',
1236
1236
  config: function config(_config, _ref) {
1237
- var _config$optimizeDeps, _config$optimizeDeps2, _config$optimizeDeps3;
1237
+ var _config$optimizeDeps, _config$optimizeDeps2, _config$optimizeDeps3, _config$optimizeDeps4;
1238
1238
  // TODO: singleton
1239
1239
  _config.resolve.alias.push({
1240
1240
  find: '@module-federation/runtime',
@@ -1243,6 +1243,7 @@ function federation(mfUserOptions) {
1243
1243
  (_config$optimizeDeps = _config.optimizeDeps) == null || (_config$optimizeDeps = _config$optimizeDeps.include) == null || _config$optimizeDeps.push('@module-federation/runtime');
1244
1244
  (_config$optimizeDeps2 = _config.optimizeDeps) == null || (_config$optimizeDeps2 = _config$optimizeDeps2.include) == null || _config$optimizeDeps2.push('__mf__virtual');
1245
1245
  (_config$optimizeDeps3 = _config.optimizeDeps) == null || (_config$optimizeDeps3 = _config$optimizeDeps3.needsInterop) == null || _config$optimizeDeps3.push('__mf__virtual');
1246
+ (_config$optimizeDeps4 = _config.optimizeDeps) == null || (_config$optimizeDeps4 = _config$optimizeDeps4.needsInterop) == null || _config$optimizeDeps4.push(getLocalSharedImportMapPath());
1246
1247
  }
1247
1248
  }], Manifest());
1248
1249
  }
@@ -1015,13 +1015,13 @@ function pluginModuleParseEnd (excludeFn) {
1015
1015
  apply: 'build',
1016
1016
  moduleParsed(module) {
1017
1017
  const id = module.id;
1018
- if (excludeFn(id)) {
1019
- return;
1020
- }
1021
1018
  if (id === VIRTUAL_EXPOSES) {
1022
1019
  // When the entry JS file is empty and only contains exposes export code, it’s necessary to wait for the exposes modules to be resolved in order to collect the dependencies being used.
1023
1020
  exposesParseEnd = true;
1024
1021
  }
1022
+ if (excludeFn(id)) {
1023
+ return;
1024
+ }
1025
1025
  parseEndSet.add(id);
1026
1026
  if (exposesParseEnd && parseStartSet.size === parseEndSet.size) {
1027
1027
  _resolve(1);
@@ -1271,7 +1271,7 @@ function federation(mfUserOptions) {
1271
1271
  entryName: 'virtualExposes',
1272
1272
  entryPath: VIRTUAL_EXPOSES
1273
1273
  }), pluginProxyRemoteEntry(), pluginProxyRemotes(options), ...pluginModuleParseEnd(id => {
1274
- return id.includes(getHostAutoInitImportId()) || id.includes(REMOTE_ENTRY_ID) || id.includes(getLocalSharedImportMapPath());
1274
+ return id.includes(getHostAutoInitImportId()) || id.includes(REMOTE_ENTRY_ID) || id.includes(VIRTUAL_EXPOSES) || id.includes(getLocalSharedImportMapPath());
1275
1275
  }), ...proxySharedModule({
1276
1276
  shared
1277
1277
  }), PluginDevProxyModuleTopLevelAwait(), {
@@ -1280,7 +1280,7 @@ function federation(mfUserOptions) {
1280
1280
  config(config, {
1281
1281
  command: _command
1282
1282
  }) {
1283
- var _config$optimizeDeps, _config$optimizeDeps2, _config$optimizeDeps3;
1283
+ var _config$optimizeDeps, _config$optimizeDeps2, _config$optimizeDeps3, _config$optimizeDeps4;
1284
1284
  // TODO: singleton
1285
1285
  config.resolve.alias.push({
1286
1286
  find: '@module-federation/runtime',
@@ -1289,6 +1289,7 @@ function federation(mfUserOptions) {
1289
1289
  (_config$optimizeDeps = config.optimizeDeps) == null || (_config$optimizeDeps = _config$optimizeDeps.include) == null || _config$optimizeDeps.push('@module-federation/runtime');
1290
1290
  (_config$optimizeDeps2 = config.optimizeDeps) == null || (_config$optimizeDeps2 = _config$optimizeDeps2.include) == null || _config$optimizeDeps2.push('__mf__virtual');
1291
1291
  (_config$optimizeDeps3 = config.optimizeDeps) == null || (_config$optimizeDeps3 = _config$optimizeDeps3.needsInterop) == null || _config$optimizeDeps3.push('__mf__virtual');
1292
+ (_config$optimizeDeps4 = config.optimizeDeps) == null || (_config$optimizeDeps4 = _config$optimizeDeps4.needsInterop) == null || _config$optimizeDeps4.push(getLocalSharedImportMapPath());
1292
1293
  }
1293
1294
  }, ...Manifest()];
1294
1295
  }
package/lib/index.umd.js CHANGED
@@ -978,13 +978,13 @@
978
978
  apply: 'build',
979
979
  moduleParsed: function moduleParsed(module) {
980
980
  var id = module.id;
981
- if (excludeFn(id)) {
982
- return;
983
- }
984
981
  if (id === VIRTUAL_EXPOSES) {
985
982
  // When the entry JS file is empty and only contains exposes export code, it’s necessary to wait for the exposes modules to be resolved in order to collect the dependencies being used.
986
983
  exposesParseEnd = true;
987
984
  }
985
+ if (excludeFn(id)) {
986
+ return;
987
+ }
988
988
  parseEndSet.add(id);
989
989
  if (exposesParseEnd && parseStartSet.size === parseEndSet.size) {
990
990
  _resolve(1);
@@ -1248,14 +1248,14 @@
1248
1248
  entryName: 'virtualExposes',
1249
1249
  entryPath: VIRTUAL_EXPOSES
1250
1250
  }), [pluginProxyRemoteEntry(), pluginProxyRemotes(options)], pluginModuleParseEnd(function (id) {
1251
- return id.includes(getHostAutoInitImportId()) || id.includes(REMOTE_ENTRY_ID) || id.includes(getLocalSharedImportMapPath());
1251
+ return id.includes(getHostAutoInitImportId()) || id.includes(REMOTE_ENTRY_ID) || id.includes(VIRTUAL_EXPOSES) || id.includes(getLocalSharedImportMapPath());
1252
1252
  }), proxySharedModule({
1253
1253
  shared: shared
1254
1254
  }), [PluginDevProxyModuleTopLevelAwait(), {
1255
1255
  name: 'module-federation-vite',
1256
1256
  enforce: 'post',
1257
1257
  config: function config(_config, _ref) {
1258
- var _config$optimizeDeps, _config$optimizeDeps2, _config$optimizeDeps3;
1258
+ var _config$optimizeDeps, _config$optimizeDeps2, _config$optimizeDeps3, _config$optimizeDeps4;
1259
1259
  // TODO: singleton
1260
1260
  _config.resolve.alias.push({
1261
1261
  find: '@module-federation/runtime',
@@ -1264,6 +1264,7 @@
1264
1264
  (_config$optimizeDeps = _config.optimizeDeps) == null || (_config$optimizeDeps = _config$optimizeDeps.include) == null || _config$optimizeDeps.push('@module-federation/runtime');
1265
1265
  (_config$optimizeDeps2 = _config.optimizeDeps) == null || (_config$optimizeDeps2 = _config$optimizeDeps2.include) == null || _config$optimizeDeps2.push('__mf__virtual');
1266
1266
  (_config$optimizeDeps3 = _config.optimizeDeps) == null || (_config$optimizeDeps3 = _config$optimizeDeps3.needsInterop) == null || _config$optimizeDeps3.push('__mf__virtual');
1267
+ (_config$optimizeDeps4 = _config.optimizeDeps) == null || (_config$optimizeDeps4 = _config$optimizeDeps4.needsInterop) == null || _config$optimizeDeps4.push(getLocalSharedImportMapPath());
1267
1268
  }
1268
1269
  }], Manifest());
1269
1270
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@module-federation/vite",
3
- "version": "1.1.1",
3
+ "version": "1.1.2",
4
4
  "description": "Vite plugin for Module Federation",
5
5
  "type": "module",
6
6
  "source": "src/index.ts",
@@ -21,8 +21,9 @@
21
21
  "dev-vv": "pnpm -filter 'examples-vite-vite*' run dev",
22
22
  "dev-nv": "pnpm -filter 'examples-nuxt-vite-host' -filter 'examples-vite-vite-remote' run dev",
23
23
  "preview-vv": "pnpm -filter 'examples-vite-vite*' run preview",
24
- "multi-example": "pnpm --filter \"multi-example-*\" run start",
25
- "test": "vitest"
24
+ "multi-example": "pnpm --filter \"multi-example-*\" --parallel run start",
25
+ "test": "vitest",
26
+ "e2e": "playwright test"
26
27
  },
27
28
  "repository": {
28
29
  "type": "git",
@@ -50,16 +51,19 @@
50
51
  "defu": "^6.1.4",
51
52
  "estree-walker": "^2",
52
53
  "magic-string": "^0.30.11",
53
- "pathe": "^1.1.2",
54
- "vitest": "^2.1.1"
54
+ "vitest": "^2.1.1",
55
+ "pathe": "^1.1.2"
55
56
  },
56
57
  "devDependencies": {
58
+ "@playwright/test": "^1.47.2",
59
+ "@types/node": "^22.7.4",
57
60
  "husky": "^8.0.3",
58
61
  "microbundle": "^0.15.1",
59
62
  "mime-types": "^2.1.35",
60
63
  "prettier": "3.3.3",
61
64
  "pretty-quick": "^4.0.0",
62
65
  "rimraf": "^6.0.1",
63
- "vite": "^5.4.3"
66
+ "vite": "^5.4.3",
67
+ "wait-on": "^8.0.1"
64
68
  }
65
69
  }