@vercel/microfrontends 1.3.0 → 1.4.0-canary.1
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/CHANGELOG.md +67 -0
- package/dist/bin/cli.cjs +8 -5
- package/dist/next/config.cjs +42 -2
- package/dist/next/config.cjs.map +1 -1
- package/dist/next/config.js +49 -2
- package/dist/next/config.js.map +1 -1
- package/package.json +8 -5
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# @vercel/microfrontends
|
|
2
|
+
|
|
3
|
+
## 1.4.0-canary.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Update the logic for which require function to use to be compatible with tsup/esbuild.
|
|
8
|
+
|
|
9
|
+
## 1.4.0-canary.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- 7817d66: Add support for next.js defineServer instead of custom webpack EnvironmentPlugin
|
|
14
|
+
|
|
15
|
+
## 1.3.0
|
|
16
|
+
|
|
17
|
+
### Minor Changes
|
|
18
|
+
|
|
19
|
+
- 8b5f62d: Replace the need to add a `.well-known` endpoint for flagged paths. Instead, just add `/.well-known/vercel/microfrontends/client-config` to your middleware matcher. Note that the middleware is only required if you have flagged paths.
|
|
20
|
+
|
|
21
|
+
## 1.2.0
|
|
22
|
+
|
|
23
|
+
### Minor Changes
|
|
24
|
+
|
|
25
|
+
- 653c9d2: Improved local development proxy, simplified config, Vite support, more detailed error messages, testing, and more!
|
|
26
|
+
|
|
27
|
+
This release has some minor breaking changes. We try not do this, but at this stage of the project (where we have a relatively small amount of users, each who we're working closely with), we are leaning more towards breaking things and providing clear upgrade instructions so we can move a little quicker. Please let us know if you have concerns with this approach!
|
|
28
|
+
|
|
29
|
+
1. The `fromApp` parameter to your call to `runMicrofrontendsMiddleware` (in your `middleware.ts` file) is gone! Please delete the parameter.
|
|
30
|
+
|
|
31
|
+
- Your code will fail to compile until you delete the parameter.
|
|
32
|
+
|
|
33
|
+
1. The `development.localPort` field in each application in your `microfrontends.json` file is renamed to `development.local`. All you need to do is delete `Port` from the field name and it will continue working exactly as before!
|
|
34
|
+
|
|
35
|
+
- The new field has improved support where you can add a full protocol/host/port if you need (for example, `https://my.localhost.me:8080`), but works the same as before if you just specify a port.
|
|
36
|
+
|
|
37
|
+
1. If the application name in your `microfrontends.json` matches the Vercel project name, the `projectId` field is no longer required, please remove it! We would like to deprecate the `projectId` field in the future. If you have any concerns, please reach out.
|
|
38
|
+
|
|
39
|
+
- `projectId` is annoying to set up so we hope this simplifies things!
|
|
40
|
+
- The Vercel project name should ideally match the application's `package.json` name. If this is not the case, you will need to set the `packageName` field to the `name` from the `package.json` file. This is needed for the local development proxy to work.
|
|
41
|
+
- Visit https://vercel.com/docs/microfrontends/troubleshooting for test utilities to validate the microfrontends setup for your application.
|
|
42
|
+
If you have any issues with these changes, please reach out! We are here to help.
|
|
43
|
+
|
|
44
|
+
## 1.1.0
|
|
45
|
+
|
|
46
|
+
### Minor Changes
|
|
47
|
+
|
|
48
|
+
- 844006a:
|
|
49
|
+
- Add experimental support for SvelteKit.
|
|
50
|
+
- Add experimental support for Vite and React Router.
|
|
51
|
+
- Improved inference for NX monorepos.
|
|
52
|
+
- Support additional path syntax, `/:path(a|b|c)`, `/:path((?!a|b|c).\*)`, and `/some-:hash.js`
|
|
53
|
+
- Fix the next/server import to avoid potential import issues for peer dependencies.
|
|
54
|
+
- Disallow deprecated fields in microfrontends config by default.
|
|
55
|
+
- Improvements/fixes to local development proxy.
|
|
56
|
+
- Add `supportPagesRouter` option that corrects `/\_next/data` requests to the correct child for Next.js Pages Router.
|
|
57
|
+
|
|
58
|
+
## 1.0.0
|
|
59
|
+
|
|
60
|
+
### Major Changes
|
|
61
|
+
|
|
62
|
+
- 37765c3: Initial public release
|
|
63
|
+
|
|
64
|
+
### Minor Changes
|
|
65
|
+
|
|
66
|
+
- b559d60: Add back Vercel specific rewrites in local package for preview and local development without the proxy
|
|
67
|
+
- 00ec734: Add back next config rewrites to deployed apps
|
package/dist/bin/cli.cjs
CHANGED
|
@@ -30,7 +30,7 @@ var import_env = require("@next/env");
|
|
|
30
30
|
// package.json
|
|
31
31
|
var package_default = {
|
|
32
32
|
name: "@vercel/microfrontends",
|
|
33
|
-
version: "1.
|
|
33
|
+
version: "1.4.0-canary.1",
|
|
34
34
|
private: false,
|
|
35
35
|
description: "Defines configuration and utilities for microfrontends development",
|
|
36
36
|
keywords: [
|
|
@@ -148,7 +148,8 @@ var package_default = {
|
|
|
148
148
|
},
|
|
149
149
|
files: [
|
|
150
150
|
"dist",
|
|
151
|
-
"schema"
|
|
151
|
+
"schema",
|
|
152
|
+
"CHANGELOG.md"
|
|
152
153
|
],
|
|
153
154
|
scripts: {
|
|
154
155
|
build: "tsup",
|
|
@@ -163,7 +164,7 @@ var package_default = {
|
|
|
163
164
|
typecheck: "tsc --noEmit"
|
|
164
165
|
},
|
|
165
166
|
dependencies: {
|
|
166
|
-
"@next/env": "15.
|
|
167
|
+
"@next/env": "15.4.0-canary.41",
|
|
167
168
|
ajv: "^8.17.1",
|
|
168
169
|
commander: "^12.1.0",
|
|
169
170
|
cookie: "0.4.0",
|
|
@@ -171,7 +172,8 @@ var package_default = {
|
|
|
171
172
|
"http-proxy": "^1.18.1",
|
|
172
173
|
"jsonc-parser": "^3.3.1",
|
|
173
174
|
nanoid: "^3.3.9",
|
|
174
|
-
"path-to-regexp": "6.2.1"
|
|
175
|
+
"path-to-regexp": "6.2.1",
|
|
176
|
+
semver: "^7.7.2"
|
|
175
177
|
},
|
|
176
178
|
devDependencies: {
|
|
177
179
|
"@edge-runtime/jest-environment": "^4.0.0",
|
|
@@ -185,10 +187,11 @@ var package_default = {
|
|
|
185
187
|
"@types/node": "20.11.30",
|
|
186
188
|
"@types/react": "18.3.1",
|
|
187
189
|
"@types/react-dom": "18.3.0",
|
|
190
|
+
"@types/semver": "^7.7.0",
|
|
188
191
|
"eslint-config-custom": "workspace:*",
|
|
189
192
|
jest: "^29.7.0",
|
|
190
193
|
"jest-environment-jsdom": "29.2.2",
|
|
191
|
-
next: "15.
|
|
194
|
+
next: "15.4.0-canary.41",
|
|
192
195
|
react: "19.0.0",
|
|
193
196
|
"react-dom": "19.0.0",
|
|
194
197
|
"ts-config": "workspace:*",
|
package/dist/next/config.cjs
CHANGED
|
@@ -1675,6 +1675,11 @@ function transform5(args) {
|
|
|
1675
1675
|
};
|
|
1676
1676
|
}
|
|
1677
1677
|
|
|
1678
|
+
// src/next/config/transforms/webpack.ts
|
|
1679
|
+
var import_node_fs8 = __toESM(require("fs"), 1);
|
|
1680
|
+
var import_node_module = require("module");
|
|
1681
|
+
var semver = __toESM(require("semver"), 1);
|
|
1682
|
+
|
|
1678
1683
|
// src/next/config/plugins/sort-chunks.ts
|
|
1679
1684
|
var SortChunksPlugin = class {
|
|
1680
1685
|
apply(compiler) {
|
|
@@ -1698,17 +1703,31 @@ var SortChunksPlugin = class {
|
|
|
1698
1703
|
};
|
|
1699
1704
|
|
|
1700
1705
|
// src/next/config/transforms/webpack.ts
|
|
1706
|
+
var import_meta = {};
|
|
1707
|
+
var nextVersion = getNextJsVersion();
|
|
1701
1708
|
function transform6(args) {
|
|
1709
|
+
const useDefineServer = args.opts?.preferWebpackEnvironmentPlugin ? false : semver.gte(nextVersion, "15.4.0-canary.41");
|
|
1702
1710
|
const { next, microfrontend, opts } = args;
|
|
1703
1711
|
const configWithWebpack = {
|
|
1704
1712
|
...next,
|
|
1713
|
+
...useDefineServer ? {
|
|
1714
|
+
compiler: {
|
|
1715
|
+
...next.compiler,
|
|
1716
|
+
defineServer: {
|
|
1717
|
+
...next.compiler?.defineServer,
|
|
1718
|
+
"process.env.MFE_CONFIG": JSON.stringify(
|
|
1719
|
+
microfrontend.serialize().config
|
|
1720
|
+
)
|
|
1721
|
+
}
|
|
1722
|
+
}
|
|
1723
|
+
} : {},
|
|
1705
1724
|
webpack(cfg, context) {
|
|
1706
1725
|
const config = typeof next.webpack === "function" ? next.webpack(cfg, context) : cfg;
|
|
1707
1726
|
const { isServer, nextRuntime, webpack: wpFromNext } = context;
|
|
1708
|
-
if (isServer || nextRuntime === "edge") {
|
|
1727
|
+
if (!useDefineServer && (isServer || nextRuntime === "edge")) {
|
|
1709
1728
|
config.plugins.push(
|
|
1710
1729
|
new wpFromNext.EnvironmentPlugin({
|
|
1711
|
-
MFE_CONFIG: JSON.stringify(microfrontend.serialize())
|
|
1730
|
+
MFE_CONFIG: JSON.stringify(microfrontend.serialize().config)
|
|
1712
1731
|
})
|
|
1713
1732
|
);
|
|
1714
1733
|
}
|
|
@@ -1742,6 +1761,27 @@ function transform6(args) {
|
|
|
1742
1761
|
next: configWithWebpack
|
|
1743
1762
|
};
|
|
1744
1763
|
}
|
|
1764
|
+
function getNextJsVersion() {
|
|
1765
|
+
const cjsRequire = (
|
|
1766
|
+
// This is used so we can use `require.resolve` to find the Next.js package:
|
|
1767
|
+
// - `import.meta.resolve` is not available in CJS or early Node.js versions.
|
|
1768
|
+
// - tsup/esbuild don't generate import meta urls for CJS modules, so use this as
|
|
1769
|
+
// a test to see if we're running in ESM. Referencing `import.meta.url` is
|
|
1770
|
+
// still grammatically valid in CJS because esbuild transforms it.
|
|
1771
|
+
typeof import_meta.url === "string" ? (0, import_node_module.createRequire)(import_meta.url) : require
|
|
1772
|
+
);
|
|
1773
|
+
const parsedNextPackageJson = JSON.parse(
|
|
1774
|
+
import_node_fs8.default.readFileSync(cjsRequire.resolve("next/package.json"), "utf8")
|
|
1775
|
+
);
|
|
1776
|
+
if (typeof parsedNextPackageJson !== "object" || parsedNextPackageJson === null) {
|
|
1777
|
+
throw new Error("Could not read 'next/package.json'.");
|
|
1778
|
+
}
|
|
1779
|
+
const parsedNextVersion = "version" in parsedNextPackageJson && parsedNextPackageJson.version;
|
|
1780
|
+
if (typeof parsedNextVersion !== "string") {
|
|
1781
|
+
throw new Error("Could not read version from 'next/package.json'.");
|
|
1782
|
+
}
|
|
1783
|
+
return parsedNextVersion;
|
|
1784
|
+
}
|
|
1745
1785
|
|
|
1746
1786
|
// src/next/config/transforms/index.ts
|
|
1747
1787
|
var transforms = {
|