@module-federation/dts-plugin 0.15.0 → 0.16.0

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/dist/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # @module-federation/dts-plugin
2
2
 
3
+ ## 0.16.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 1485fcf: added flag to fetch types from remote when building in production.
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies [1485fcf]
12
+ - @module-federation/sdk@0.16.0
13
+ - @module-federation/managers@0.16.0
14
+ - @module-federation/third-party-dts-extractor@0.16.0
15
+ - @module-federation/error-codes@0.16.0
16
+
3
17
  ## 0.15.0
4
18
 
5
19
  ### Patch Changes
package/dist/core.js CHANGED
@@ -1218,7 +1218,8 @@ var defaultOptions = {
1218
1218
  consumeAPITypes: false,
1219
1219
  runtimePkgs: [],
1220
1220
  remoteTypeUrls: {},
1221
- timeout: 6e4
1221
+ timeout: 6e4,
1222
+ typesOnBuild: false
1222
1223
  };
1223
1224
  var buildZipUrl = /* @__PURE__ */ __name((hostOptions, url) => {
1224
1225
  const remoteUrl = new URL(url, "file:");
@@ -1398,7 +1399,7 @@ var DTSManager = (_a = class {
1398
1399
  // it must execute after consumeTypes
1399
1400
  generateTypes() {
1400
1401
  return __async(this, null, function* () {
1401
- var _a3;
1402
+ var _a3, _b;
1402
1403
  try {
1403
1404
  const { options } = this;
1404
1405
  if (!options.remote) {
@@ -1408,6 +1409,10 @@ var DTSManager = (_a = class {
1408
1409
  if (!Object.keys(mapComponentsToExpose).length) {
1409
1410
  return;
1410
1411
  }
1412
+ if (!((_a3 = tsConfig.files) == null ? void 0 : _a3.length)) {
1413
+ logger.info("No type files to compile, skip");
1414
+ return;
1415
+ }
1411
1416
  if (tsConfig.compilerOptions.tsBuildInfoFile) {
1412
1417
  try {
1413
1418
  const tsBuildInfoFile = import_path3.default.resolve(remoteOptions.context, tsConfig.compilerOptions.tsBuildInfoFile);
@@ -1447,7 +1452,7 @@ var DTSManager = (_a = class {
1447
1452
  }
1448
1453
  logger.success("Federated types created correctly");
1449
1454
  } catch (error2) {
1450
- if (((_a3 = this.options.remote) == null ? void 0 : _a3.abortOnError) === false) {
1455
+ if (((_b = this.options.remote) == null ? void 0 : _b.abortOnError) === false) {
1451
1456
  if (this.options.displayErrorInTerminal) {
1452
1457
  logger.error(error2);
1453
1458
  }
@@ -1752,7 +1757,7 @@ function retrieveTypesAssetsInfo(options) {
1752
1757
  let zipPrefix = "";
1753
1758
  try {
1754
1759
  const { tsConfig, remoteOptions, mapComponentsToExpose } = retrieveRemoteConfig(options);
1755
- if (!Object.keys(mapComponentsToExpose).length) {
1760
+ if (!Object.keys(mapComponentsToExpose).length || !tsConfig.files.length) {
1756
1761
  return {
1757
1762
  zipPrefix,
1758
1763
  apiTypesPath,
@@ -1920,11 +1925,15 @@ var readTsConfig = /* @__PURE__ */ __name(({ tsConfigPath, typesFolder, compiled
1920
1925
  const _a3 = rawTsConfigJson.compilerOptions || {}, { paths, baseUrl } = _a3, restCompilerOptions = __objRest(_a3, ["paths", "baseUrl"]);
1921
1926
  rawTsConfigJson.compilerOptions = restCompilerOptions;
1922
1927
  const outDirWithoutTypesFolder = (0, import_path5.resolve)(context, outputDir || configContent.options.outDir || "dist");
1928
+ const excludeExtensions = [
1929
+ ".mdx",
1930
+ ".md"
1931
+ ];
1923
1932
  const filesToCompile = [
1924
1933
  ...Object.values(mapComponentsToExpose),
1925
1934
  ...configContent.fileNames.filter((filename) => filename.endsWith(".d.ts") && !filename.startsWith(outDirWithoutTypesFolder)),
1926
1935
  ...additionalFilesToCompile
1927
- ];
1936
+ ].filter((filename) => !excludeExtensions.some((ext) => filename.endsWith(ext)));
1928
1937
  rawTsConfigJson.include = [];
1929
1938
  rawTsConfigJson.files = filesToCompile;
1930
1939
  rawTsConfigJson.exclude = [];
@@ -4,7 +4,7 @@ import {
4
4
  exposeRpc,
5
5
  getDTSManagerConstructor,
6
6
  isDebugMode
7
- } from "./chunk-4LAJMII5.js";
7
+ } from "./chunk-NLANHIXS.js";
8
8
  import {
9
9
  __async,
10
10
  __export,
@@ -654,11 +654,15 @@ var readTsConfig = /* @__PURE__ */ __name(({ tsConfigPath, typesFolder, compiled
654
654
  const _a2 = rawTsConfigJson.compilerOptions || {}, { paths, baseUrl } = _a2, restCompilerOptions = __objRest(_a2, ["paths", "baseUrl"]);
655
655
  rawTsConfigJson.compilerOptions = restCompilerOptions;
656
656
  const outDirWithoutTypesFolder = resolve2(context, outputDir || configContent.options.outDir || "dist");
657
+ const excludeExtensions = [
658
+ ".mdx",
659
+ ".md"
660
+ ];
657
661
  const filesToCompile = [
658
662
  ...Object.values(mapComponentsToExpose),
659
663
  ...configContent.fileNames.filter((filename) => filename.endsWith(".d.ts") && !filename.startsWith(outDirWithoutTypesFolder)),
660
664
  ...additionalFilesToCompile
661
- ];
665
+ ].filter((filename) => !excludeExtensions.some((ext) => filename.endsWith(ext)));
662
666
  rawTsConfigJson.include = [];
663
667
  rawTsConfigJson.files = filesToCompile;
664
668
  rawTsConfigJson.exclude = [];
@@ -735,7 +739,8 @@ var defaultOptions2 = {
735
739
  consumeAPITypes: false,
736
740
  runtimePkgs: [],
737
741
  remoteTypeUrls: {},
738
- timeout: 6e4
742
+ timeout: 6e4,
743
+ typesOnBuild: false
739
744
  };
740
745
  var buildZipUrl = /* @__PURE__ */ __name((hostOptions, url) => {
741
746
  const remoteUrl = new URL(url, "file:");
@@ -915,7 +920,7 @@ var DTSManager = (_a = class {
915
920
  // it must execute after consumeTypes
916
921
  generateTypes() {
917
922
  return __async(this, null, function* () {
918
- var _a2;
923
+ var _a2, _b;
919
924
  try {
920
925
  const { options } = this;
921
926
  if (!options.remote) {
@@ -925,6 +930,10 @@ var DTSManager = (_a = class {
925
930
  if (!Object.keys(mapComponentsToExpose).length) {
926
931
  return;
927
932
  }
933
+ if (!((_a2 = tsConfig.files) == null ? void 0 : _a2.length)) {
934
+ logger.info("No type files to compile, skip");
935
+ return;
936
+ }
928
937
  if (tsConfig.compilerOptions.tsBuildInfoFile) {
929
938
  try {
930
939
  const tsBuildInfoFile = path2.resolve(remoteOptions.context, tsConfig.compilerOptions.tsBuildInfoFile);
@@ -964,7 +973,7 @@ var DTSManager = (_a = class {
964
973
  }
965
974
  logger.success("Federated types created correctly");
966
975
  } catch (error) {
967
- if (((_a2 = this.options.remote) == null ? void 0 : _a2.abortOnError) === false) {
976
+ if (((_b = this.options.remote) == null ? void 0 : _b.abortOnError) === false) {
968
977
  if (this.options.displayErrorInTerminal) {
969
978
  logger.error(error);
970
979
  }
@@ -1269,7 +1278,7 @@ function retrieveTypesAssetsInfo(options) {
1269
1278
  let zipPrefix = "";
1270
1279
  try {
1271
1280
  const { tsConfig, remoteOptions, mapComponentsToExpose } = retrieveRemoteConfig(options);
1272
- if (!Object.keys(mapComponentsToExpose).length) {
1281
+ if (!Object.keys(mapComponentsToExpose).length || !tsConfig.files.length) {
1273
1282
  return {
1274
1283
  zipPrefix,
1275
1284
  apiTypesPath,
package/dist/esm/core.js CHANGED
@@ -3,7 +3,7 @@ import {
3
3
  consumeTypes,
4
4
  generateTypesInChildProcess,
5
5
  rpc_exports
6
- } from "./chunk-YVBDT2VM.js";
6
+ } from "./chunk-4XXQY6FQ.js";
7
7
  import {
8
8
  DTSManager,
9
9
  HOST_API_TYPES_FILE_NAME,
@@ -19,7 +19,7 @@ import {
19
19
  retrieveTypesAssetsInfo,
20
20
  retrieveTypesZipPath,
21
21
  validateOptions
22
- } from "./chunk-4LAJMII5.js";
22
+ } from "./chunk-NLANHIXS.js";
23
23
  import "./chunk-WWV5RWOP.js";
24
24
  import "./chunk-647HGGGS.js";
25
25
  export {
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  rpc_exports
3
- } from "./chunk-YVBDT2VM.js";
3
+ } from "./chunk-4XXQY6FQ.js";
4
4
  import {
5
5
  ModuleFederationDevServer,
6
6
  createKoaServer,
@@ -9,7 +9,7 @@ import {
9
9
  retrieveMfTypesPath,
10
10
  retrieveRemoteConfig,
11
11
  retrieveTypesZipPath
12
- } from "./chunk-4LAJMII5.js";
12
+ } from "./chunk-NLANHIXS.js";
13
13
  import {
14
14
  fileLog,
15
15
  getIPV4
@@ -2,7 +2,7 @@ import {
2
2
  RpcGMCallTypes,
3
3
  exposeRpc,
4
4
  generateTypes
5
- } from "./chunk-4LAJMII5.js";
5
+ } from "./chunk-NLANHIXS.js";
6
6
  import "./chunk-WWV5RWOP.js";
7
7
  import {
8
8
  __async,
package/dist/esm/index.js CHANGED
@@ -2,14 +2,14 @@ import {
2
2
  consumeTypes,
3
3
  generateTypesInChildProcess,
4
4
  rpc_exports
5
- } from "./chunk-YVBDT2VM.js";
5
+ } from "./chunk-4XXQY6FQ.js";
6
6
  import {
7
7
  cloneDeepOptions,
8
8
  generateTypes,
9
9
  isTSProject,
10
10
  retrieveTypesAssetsInfo,
11
11
  validateOptions
12
- } from "./chunk-4LAJMII5.js";
12
+ } from "./chunk-NLANHIXS.js";
13
13
  import {
14
14
  getIPV4,
15
15
  logger
@@ -285,7 +285,8 @@ import { logger as logger2 } from "@module-federation/sdk";
285
285
  import { normalizeOptions as normalizeOptions2 } from "@module-federation/sdk";
286
286
  var DEFAULT_CONSUME_TYPES = {
287
287
  abortOnError: false,
288
- consumeAPITypes: true
288
+ consumeAPITypes: true,
289
+ typesOnBuild: false
289
290
  };
290
291
  var normalizeConsumeTypesOptions = /* @__PURE__ */ __name(({ context, dtsOptions, pluginOptions }) => {
291
292
  const normalizedConsumeTypes = normalizeOptions2(true, DEFAULT_CONSUME_TYPES, "mfOptions.dts.consumeTypes")(dtsOptions.consumeTypes);
@@ -330,10 +331,6 @@ var _ConsumeTypesPlugin = class _ConsumeTypesPlugin {
330
331
  }
331
332
  apply(compiler) {
332
333
  const { dtsOptions, pluginOptions, fetchRemoteTypeUrlsResolve } = this;
333
- if (isPrd()) {
334
- fetchRemoteTypeUrlsResolve(void 0);
335
- return;
336
- }
337
334
  const dtsManagerOptions = normalizeConsumeTypesOptions({
338
335
  context: compiler.context,
339
336
  dtsOptions,
@@ -343,6 +340,10 @@ var _ConsumeTypesPlugin = class _ConsumeTypesPlugin {
343
340
  fetchRemoteTypeUrlsResolve(void 0);
344
341
  return;
345
342
  }
343
+ if (isPrd() && !dtsManagerOptions.host.typesOnBuild) {
344
+ fetchRemoteTypeUrlsResolve(void 0);
345
+ return;
346
+ }
346
347
  logger2.debug("start fetching remote types...");
347
348
  const promise = consumeTypesAPI(dtsManagerOptions, fetchRemoteTypeUrlsResolve);
348
349
  compiler.hooks.thisCompilation.tap("mf:generateTypes", (compilation) => {
@@ -1738,7 +1738,8 @@ var defaultOptions = {
1738
1738
  consumeAPITypes: false,
1739
1739
  runtimePkgs: [],
1740
1740
  remoteTypeUrls: {},
1741
- timeout: 6e4
1741
+ timeout: 6e4,
1742
+ typesOnBuild: false
1742
1743
  };
1743
1744
  var buildZipUrl = /* @__PURE__ */ __name((hostOptions, url) => {
1744
1745
  const remoteUrl = new URL(url, "file:");
@@ -1918,7 +1919,7 @@ var DTSManager = (_a = class {
1918
1919
  // it must execute after consumeTypes
1919
1920
  generateTypes() {
1920
1921
  return __async(this, null, function* () {
1921
- var _a3;
1922
+ var _a3, _b;
1922
1923
  try {
1923
1924
  const { options } = this;
1924
1925
  if (!options.remote) {
@@ -1928,6 +1929,10 @@ var DTSManager = (_a = class {
1928
1929
  if (!Object.keys(mapComponentsToExpose).length) {
1929
1930
  return;
1930
1931
  }
1932
+ if (!((_a3 = tsConfig.files) == null ? void 0 : _a3.length)) {
1933
+ logger.info("No type files to compile, skip");
1934
+ return;
1935
+ }
1931
1936
  if (tsConfig.compilerOptions.tsBuildInfoFile) {
1932
1937
  try {
1933
1938
  const tsBuildInfoFile = import_path4.default.resolve(remoteOptions.context, tsConfig.compilerOptions.tsBuildInfoFile);
@@ -1967,7 +1972,7 @@ var DTSManager = (_a = class {
1967
1972
  }
1968
1973
  logger.success("Federated types created correctly");
1969
1974
  } catch (error2) {
1970
- if (((_a3 = this.options.remote) == null ? void 0 : _a3.abortOnError) === false) {
1975
+ if (((_b = this.options.remote) == null ? void 0 : _b.abortOnError) === false) {
1971
1976
  if (this.options.displayErrorInTerminal) {
1972
1977
  logger.error(error2);
1973
1978
  }
@@ -2374,11 +2379,15 @@ var readTsConfig = /* @__PURE__ */ __name(({ tsConfigPath, typesFolder, compiled
2374
2379
  const _a3 = rawTsConfigJson.compilerOptions || {}, { paths, baseUrl } = _a3, restCompilerOptions = __objRest(_a3, ["paths", "baseUrl"]);
2375
2380
  rawTsConfigJson.compilerOptions = restCompilerOptions;
2376
2381
  const outDirWithoutTypesFolder = (0, import_path5.resolve)(context, outputDir || configContent.options.outDir || "dist");
2382
+ const excludeExtensions = [
2383
+ ".mdx",
2384
+ ".md"
2385
+ ];
2377
2386
  const filesToCompile = [
2378
2387
  ...Object.values(mapComponentsToExpose),
2379
2388
  ...configContent.fileNames.filter((filename) => filename.endsWith(".d.ts") && !filename.startsWith(outDirWithoutTypesFolder)),
2380
2389
  ...additionalFilesToCompile
2381
- ];
2390
+ ].filter((filename) => !excludeExtensions.some((ext) => filename.endsWith(ext)));
2382
2391
  rawTsConfigJson.include = [];
2383
2392
  rawTsConfigJson.files = filesToCompile;
2384
2393
  rawTsConfigJson.exclude = [];
@@ -227,11 +227,15 @@ var readTsConfig = /* @__PURE__ */ __name(({ tsConfigPath, typesFolder, compiled
227
227
  const _a2 = rawTsConfigJson.compilerOptions || {}, { paths, baseUrl } = _a2, restCompilerOptions = __objRest(_a2, ["paths", "baseUrl"]);
228
228
  rawTsConfigJson.compilerOptions = restCompilerOptions;
229
229
  const outDirWithoutTypesFolder = (0, import_path.resolve)(context, outputDir || configContent.options.outDir || "dist");
230
+ const excludeExtensions = [
231
+ ".mdx",
232
+ ".md"
233
+ ];
230
234
  const filesToCompile = [
231
235
  ...Object.values(mapComponentsToExpose),
232
236
  ...configContent.fileNames.filter((filename) => filename.endsWith(".d.ts") && !filename.startsWith(outDirWithoutTypesFolder)),
233
237
  ...additionalFilesToCompile
234
- ];
238
+ ].filter((filename) => !excludeExtensions.some((ext) => filename.endsWith(ext)));
235
239
  rawTsConfigJson.include = [];
236
240
  rawTsConfigJson.files = filesToCompile;
237
241
  rawTsConfigJson.exclude = [];
@@ -1385,7 +1389,8 @@ var defaultOptions2 = {
1385
1389
  consumeAPITypes: false,
1386
1390
  runtimePkgs: [],
1387
1391
  remoteTypeUrls: {},
1388
- timeout: 6e4
1392
+ timeout: 6e4,
1393
+ typesOnBuild: false
1389
1394
  };
1390
1395
  var buildZipUrl = /* @__PURE__ */ __name((hostOptions, url) => {
1391
1396
  const remoteUrl = new URL(url, "file:");
@@ -1565,7 +1570,7 @@ var DTSManager = (_a = class {
1565
1570
  // it must execute after consumeTypes
1566
1571
  generateTypes() {
1567
1572
  return __async(this, null, function* () {
1568
- var _a2;
1573
+ var _a2, _b;
1569
1574
  try {
1570
1575
  const { options } = this;
1571
1576
  if (!options.remote) {
@@ -1575,6 +1580,10 @@ var DTSManager = (_a = class {
1575
1580
  if (!Object.keys(mapComponentsToExpose).length) {
1576
1581
  return;
1577
1582
  }
1583
+ if (!((_a2 = tsConfig.files) == null ? void 0 : _a2.length)) {
1584
+ logger.info("No type files to compile, skip");
1585
+ return;
1586
+ }
1578
1587
  if (tsConfig.compilerOptions.tsBuildInfoFile) {
1579
1588
  try {
1580
1589
  const tsBuildInfoFile = import_path4.default.resolve(remoteOptions.context, tsConfig.compilerOptions.tsBuildInfoFile);
@@ -1614,7 +1623,7 @@ var DTSManager = (_a = class {
1614
1623
  }
1615
1624
  logger.success("Federated types created correctly");
1616
1625
  } catch (error2) {
1617
- if (((_a2 = this.options.remote) == null ? void 0 : _a2.abortOnError) === false) {
1626
+ if (((_b = this.options.remote) == null ? void 0 : _b.abortOnError) === false) {
1618
1627
  if (this.options.displayErrorInTerminal) {
1619
1628
  logger.error(error2);
1620
1629
  }
package/dist/index.d.mts CHANGED
@@ -32,6 +32,7 @@ declare const normalizeConsumeTypesOptions: ({ context, dtsOptions, pluginOption
32
32
  runtimePkgs?: string[];
33
33
  remoteTypeUrls?: (() => Promise<moduleFederationPlugin.RemoteTypeUrls>) | moduleFederationPlugin.RemoteTypeUrls;
34
34
  timeout?: number;
35
+ typesOnBuild?: boolean;
35
36
  implementation: string;
36
37
  context: string;
37
38
  moduleFederationConfig: moduleFederationPlugin.ModuleFederationPluginOptions;
package/dist/index.d.ts CHANGED
@@ -32,6 +32,7 @@ declare const normalizeConsumeTypesOptions: ({ context, dtsOptions, pluginOption
32
32
  runtimePkgs?: string[];
33
33
  remoteTypeUrls?: (() => Promise<moduleFederationPlugin.RemoteTypeUrls>) | moduleFederationPlugin.RemoteTypeUrls;
34
34
  timeout?: number;
35
+ typesOnBuild?: boolean;
35
36
  implementation: string;
36
37
  context: string;
37
38
  moduleFederationConfig: moduleFederationPlugin.ModuleFederationPluginOptions;
package/dist/index.js CHANGED
@@ -1247,7 +1247,8 @@ var defaultOptions = {
1247
1247
  consumeAPITypes: false,
1248
1248
  runtimePkgs: [],
1249
1249
  remoteTypeUrls: {},
1250
- timeout: 6e4
1250
+ timeout: 6e4,
1251
+ typesOnBuild: false
1251
1252
  };
1252
1253
  var buildZipUrl = /* @__PURE__ */ __name((hostOptions, url) => {
1253
1254
  const remoteUrl = new URL(url, "file:");
@@ -1427,7 +1428,7 @@ var DTSManager = (_a = class {
1427
1428
  // it must execute after consumeTypes
1428
1429
  generateTypes() {
1429
1430
  return __async(this, null, function* () {
1430
- var _a3;
1431
+ var _a3, _b;
1431
1432
  try {
1432
1433
  const { options } = this;
1433
1434
  if (!options.remote) {
@@ -1437,6 +1438,10 @@ var DTSManager = (_a = class {
1437
1438
  if (!Object.keys(mapComponentsToExpose).length) {
1438
1439
  return;
1439
1440
  }
1441
+ if (!((_a3 = tsConfig.files) == null ? void 0 : _a3.length)) {
1442
+ logger.info("No type files to compile, skip");
1443
+ return;
1444
+ }
1440
1445
  if (tsConfig.compilerOptions.tsBuildInfoFile) {
1441
1446
  try {
1442
1447
  const tsBuildInfoFile = import_path3.default.resolve(remoteOptions.context, tsConfig.compilerOptions.tsBuildInfoFile);
@@ -1476,7 +1481,7 @@ var DTSManager = (_a = class {
1476
1481
  }
1477
1482
  logger.success("Federated types created correctly");
1478
1483
  } catch (error2) {
1479
- if (((_a3 = this.options.remote) == null ? void 0 : _a3.abortOnError) === false) {
1484
+ if (((_b = this.options.remote) == null ? void 0 : _b.abortOnError) === false) {
1480
1485
  if (this.options.displayErrorInTerminal) {
1481
1486
  logger.error(error2);
1482
1487
  }
@@ -1781,7 +1786,7 @@ function retrieveTypesAssetsInfo(options) {
1781
1786
  let zipPrefix = "";
1782
1787
  try {
1783
1788
  const { tsConfig, remoteOptions, mapComponentsToExpose } = retrieveRemoteConfig(options);
1784
- if (!Object.keys(mapComponentsToExpose).length) {
1789
+ if (!Object.keys(mapComponentsToExpose).length || !tsConfig.files.length) {
1785
1790
  return {
1786
1791
  zipPrefix,
1787
1792
  apiTypesPath,
@@ -1949,11 +1954,15 @@ var readTsConfig = /* @__PURE__ */ __name(({ tsConfigPath, typesFolder, compiled
1949
1954
  const _a3 = rawTsConfigJson.compilerOptions || {}, { paths, baseUrl } = _a3, restCompilerOptions = __objRest(_a3, ["paths", "baseUrl"]);
1950
1955
  rawTsConfigJson.compilerOptions = restCompilerOptions;
1951
1956
  const outDirWithoutTypesFolder = (0, import_path5.resolve)(context, outputDir || configContent.options.outDir || "dist");
1957
+ const excludeExtensions = [
1958
+ ".mdx",
1959
+ ".md"
1960
+ ];
1952
1961
  const filesToCompile = [
1953
1962
  ...Object.values(mapComponentsToExpose),
1954
1963
  ...configContent.fileNames.filter((filename) => filename.endsWith(".d.ts") && !filename.startsWith(outDirWithoutTypesFolder)),
1955
1964
  ...additionalFilesToCompile
1956
- ];
1965
+ ].filter((filename) => !excludeExtensions.some((ext) => filename.endsWith(ext)));
1957
1966
  rawTsConfigJson.include = [];
1958
1967
  rawTsConfigJson.files = filesToCompile;
1959
1968
  rawTsConfigJson.exclude = [];
@@ -2600,7 +2609,8 @@ var import_sdk8 = require("@module-federation/sdk");
2600
2609
  var import_sdk9 = require("@module-federation/sdk");
2601
2610
  var DEFAULT_CONSUME_TYPES = {
2602
2611
  abortOnError: false,
2603
- consumeAPITypes: true
2612
+ consumeAPITypes: true,
2613
+ typesOnBuild: false
2604
2614
  };
2605
2615
  var normalizeConsumeTypesOptions = /* @__PURE__ */ __name(({ context, dtsOptions, pluginOptions }) => {
2606
2616
  const normalizedConsumeTypes = (0, import_sdk9.normalizeOptions)(true, DEFAULT_CONSUME_TYPES, "mfOptions.dts.consumeTypes")(dtsOptions.consumeTypes);
@@ -2645,10 +2655,6 @@ var _ConsumeTypesPlugin = class _ConsumeTypesPlugin {
2645
2655
  }
2646
2656
  apply(compiler) {
2647
2657
  const { dtsOptions, pluginOptions, fetchRemoteTypeUrlsResolve } = this;
2648
- if (isPrd()) {
2649
- fetchRemoteTypeUrlsResolve(void 0);
2650
- return;
2651
- }
2652
2658
  const dtsManagerOptions = normalizeConsumeTypesOptions({
2653
2659
  context: compiler.context,
2654
2660
  dtsOptions,
@@ -2658,6 +2664,10 @@ var _ConsumeTypesPlugin = class _ConsumeTypesPlugin {
2658
2664
  fetchRemoteTypeUrlsResolve(void 0);
2659
2665
  return;
2660
2666
  }
2667
+ if (isPrd() && !dtsManagerOptions.host.typesOnBuild) {
2668
+ fetchRemoteTypeUrlsResolve(void 0);
2669
+ return;
2670
+ }
2661
2671
  import_sdk8.logger.debug("start fetching remote types...");
2662
2672
  const promise = consumeTypesAPI(dtsManagerOptions, fetchRemoteTypeUrlsResolve);
2663
2673
  compiler.hooks.thisCompilation.tap("mf:generateTypes", (compilation) => {
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@module-federation/dts-plugin",
3
- "version": "0.15.0",
3
+ "version": "0.16.0",
4
4
  "author": "hanric <hanric.zhang@gmail.com>",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@module-federation/dts-plugin",
3
- "version": "0.15.0",
3
+ "version": "0.16.0",
4
4
  "author": "hanric <hanric.zhang@gmail.com>",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",
@@ -60,10 +60,10 @@
60
60
  "log4js": "6.9.1",
61
61
  "node-schedule": "2.1.1",
62
62
  "ws": "8.18.0",
63
- "@module-federation/sdk": "0.15.0",
64
- "@module-federation/managers": "0.15.0",
65
- "@module-federation/third-party-dts-extractor": "0.15.0",
66
- "@module-federation/error-codes": "0.15.0"
63
+ "@module-federation/sdk": "0.16.0",
64
+ "@module-federation/managers": "0.16.0",
65
+ "@module-federation/third-party-dts-extractor": "0.16.0",
66
+ "@module-federation/error-codes": "0.16.0"
67
67
  },
68
68
  "devDependencies": {
69
69
  "@types/ws": "8.5.12",
@@ -73,7 +73,7 @@
73
73
  "@vue/tsconfig": "^0.7.0",
74
74
  "vue-tsc": "^2.2.10",
75
75
  "rimraf": "~6.0.1",
76
- "@module-federation/runtime": "0.15.0"
76
+ "@module-federation/runtime": "0.16.0"
77
77
  },
78
78
  "peerDependencies": {
79
79
  "typescript": "^4.9.0 || ^5.0.0",