@vercel/microfrontends 1.5.0-canary.1 → 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
  /**
@@ -1473,6 +1473,10 @@ function transform(args) {
1473
1473
  );
1474
1474
  }
1475
1475
  next.assetPrefix = assetPrefix;
1476
+ next.images = {
1477
+ ...next.images,
1478
+ path: `${assetPrefix}/_next/image`
1479
+ };
1476
1480
  return {
1477
1481
  next
1478
1482
  };
@@ -1559,6 +1563,20 @@ ${indent} - Automatically redirecting all requests to local microfrontends proxy
1559
1563
  return { next };
1560
1564
  }
1561
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
+
1562
1580
  // src/next/config/transforms/rewrites.ts
1563
1581
  function debugRewrites(rewrites) {
1564
1582
  if (process.env.MFE_DEBUG) {
@@ -1591,7 +1609,7 @@ function rewritesMapToArr(rewrites) {
1591
1609
  ];
1592
1610
  });
1593
1611
  }
1594
- function transform5(args) {
1612
+ function transform6(args) {
1595
1613
  const { app, next } = args;
1596
1614
  const buildBeforeFiles = () => {
1597
1615
  const rewrites = /* @__PURE__ */ new Map();
@@ -1675,7 +1693,7 @@ var SortChunksPlugin = class {
1675
1693
 
1676
1694
  // src/next/config/transforms/webpack.ts
1677
1695
  var nextVersion = getNextJsVersion();
1678
- function transform6(args) {
1696
+ function transform7(args) {
1679
1697
  const useDefineServer = args.opts?.preferWebpackEnvironmentPlugin ? false : semver.gte(nextVersion, "15.4.0-canary.41");
1680
1698
  const { next, microfrontend, opts } = args;
1681
1699
  const configWithWebpack = {
@@ -1759,8 +1777,9 @@ var transforms = {
1759
1777
  buildId: transform2,
1760
1778
  draftMode: transform3,
1761
1779
  redirects: transform4,
1762
- rewrites: transform5,
1763
- webpack: transform6
1780
+ rewrites: transform6,
1781
+ transpilePackages: transform5,
1782
+ webpack: transform7
1764
1783
  };
1765
1784
 
1766
1785
  // src/next/config/env.ts
@@ -1825,13 +1844,13 @@ function withMicrofrontends(nextConfig, opts) {
1825
1844
  const app = microfrontends.config.getApplication(fromApp);
1826
1845
  setEnvironment({ app, microfrontends });
1827
1846
  let next = { ...nextConfig };
1828
- for (const [key, transform7] of typedEntries(transforms)) {
1847
+ for (const [key, transform8] of typedEntries(transforms)) {
1829
1848
  if (opts?.skipTransforms?.includes(key)) {
1830
1849
  console.log(`Skipping ${key} transform`);
1831
1850
  continue;
1832
1851
  }
1833
1852
  try {
1834
- const transformedConfig = transform7({
1853
+ const transformedConfig = transform8({
1835
1854
  app,
1836
1855
  next,
1837
1856
  microfrontend: microfrontends.config,