@vercel/microfrontends 1.5.0-canary.2 → 1.5.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.
@@ -1,6 +1,6 @@
1
1
  import { NextConfig } from 'next';
2
2
 
3
- type TransformKeys = 'assetPrefix' | 'buildId' | 'draftMode' | 'redirects' | 'rewrites' | 'webpack';
3
+ type TransformKeys = 'assetPrefix' | 'buildId' | 'draftMode' | 'redirects' | 'rewrites' | 'transpilePackages' | 'webpack';
4
4
 
5
5
  interface WithMicrofrontendsOptions {
6
6
  /**
@@ -1563,6 +1563,20 @@ ${indent} - Automatically redirecting all requests to local microfrontends proxy
1563
1563
  return { next };
1564
1564
  }
1565
1565
 
1566
+ // src/next/config/transforms/transpile-packages.ts
1567
+ function transform5(args) {
1568
+ const { next } = args;
1569
+ if (next.transpilePackages === void 0 || !next.transpilePackages.includes("@vercel/microfrontends")) {
1570
+ next.transpilePackages = [
1571
+ ...next.transpilePackages || [],
1572
+ "@vercel/microfrontends"
1573
+ ];
1574
+ }
1575
+ return {
1576
+ next
1577
+ };
1578
+ }
1579
+
1566
1580
  // src/next/config/transforms/rewrites.ts
1567
1581
  function debugRewrites(rewrites) {
1568
1582
  if (process.env.MFE_DEBUG) {
@@ -1595,7 +1609,7 @@ function rewritesMapToArr(rewrites) {
1595
1609
  ];
1596
1610
  });
1597
1611
  }
1598
- function transform5(args) {
1612
+ function transform6(args) {
1599
1613
  const { app, next } = args;
1600
1614
  const buildBeforeFiles = () => {
1601
1615
  const rewrites = /* @__PURE__ */ new Map();
@@ -1679,7 +1693,7 @@ var SortChunksPlugin = class {
1679
1693
 
1680
1694
  // src/next/config/transforms/webpack.ts
1681
1695
  var nextVersion = getNextJsVersion();
1682
- function transform6(args) {
1696
+ function transform7(args) {
1683
1697
  const useDefineServer = args.opts?.preferWebpackEnvironmentPlugin ? false : semver.gte(nextVersion, "15.4.0-canary.41");
1684
1698
  const { next, microfrontend, opts } = args;
1685
1699
  const configWithWebpack = {
@@ -1763,8 +1777,9 @@ var transforms = {
1763
1777
  buildId: transform2,
1764
1778
  draftMode: transform3,
1765
1779
  redirects: transform4,
1766
- rewrites: transform5,
1767
- webpack: transform6
1780
+ rewrites: transform6,
1781
+ transpilePackages: transform5,
1782
+ webpack: transform7
1768
1783
  };
1769
1784
 
1770
1785
  // src/next/config/env.ts
@@ -1829,13 +1844,13 @@ function withMicrofrontends(nextConfig, opts) {
1829
1844
  const app = microfrontends.config.getApplication(fromApp);
1830
1845
  setEnvironment({ app, microfrontends });
1831
1846
  let next = { ...nextConfig };
1832
- for (const [key, transform7] of typedEntries(transforms)) {
1847
+ for (const [key, transform8] of typedEntries(transforms)) {
1833
1848
  if (opts?.skipTransforms?.includes(key)) {
1834
1849
  console.log(`Skipping ${key} transform`);
1835
1850
  continue;
1836
1851
  }
1837
1852
  try {
1838
- const transformedConfig = transform7({
1853
+ const transformedConfig = transform8({
1839
1854
  app,
1840
1855
  next,
1841
1856
  microfrontend: microfrontends.config,