@payloadcms/next 3.68.0-internal.2b8df4a → 3.68.0-internal.4c88018

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,237 +1,297 @@
1
- /**
2
- * @param {import('next').NextConfig} nextConfig
3
- * @param {Object} [options] - Optional configuration options
4
- * @param {boolean} [options.devBundleServerPackages] - Whether to bundle server packages in development mode. @default false
5
- *
6
- * @returns {import('next').NextConfig}
7
- * */ "use strict";
8
- Object.defineProperty(exports, "__esModule", {
9
- value: true
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // dist/withPayload/withPayload.js
20
+ var withPayload_exports = {};
21
+ __export(withPayload_exports, {
22
+ default: () => withPayload_default,
23
+ withPayload: () => withPayload
10
24
  });
11
- function _export(target, all) {
12
- for(var name in all)Object.defineProperty(target, name, {
13
- enumerable: true,
14
- get: Object.getOwnPropertyDescriptor(all, name).get
15
- });
25
+ module.exports = __toCommonJS(withPayload_exports);
26
+
27
+ // dist/withPayload/withPayload.utils.js
28
+ var import_fs = require("fs");
29
+ var import_meta = {};
30
+ function _parseInt(input) {
31
+ return parseInt(input || "", 10);
16
32
  }
17
- _export(exports, {
18
- get default () {
19
- return _default;
20
- },
21
- get withPayload () {
22
- return withPayload;
23
- }
24
- });
25
- const withPayload = (nextConfig = {}, options = {})=>{
26
- const env = nextConfig.env || {};
27
- if (nextConfig.experimental?.staleTimes?.dynamic) {
28
- console.warn('Payload detected a non-zero value for the `staleTimes.dynamic` option in your Next.js config. This will slow down page transitions and may cause stale data to load within the Admin panel. To clear this warning, remove the `staleTimes.dynamic` option from your Next.js config or set it to 0. In the future, Next.js may support scoping this option to specific routes.');
29
- env.NEXT_PUBLIC_ENABLE_ROUTER_CACHE_REFRESH = 'true';
30
- }
31
- if (process.env.PAYLOAD_PATCH_TURBOPACK_WARNINGS !== 'false') {
32
- // TODO: This warning is thrown because we cannot externalize the entry-point package for client-s3, so we patch the warning to not show it.
33
- // We can remove this once Next.js implements https://github.com/vercel/next.js/discussions/76991
34
- const turbopackWarningText = 'Packages that should be external need to be installed in the project directory, so they can be resolved from the output files.\nTry to install it into the project directory by running';
35
- // TODO 4.0: Remove this once we drop support for Next.js 15.2.x
36
- const turbopackConfigWarningText = "Unrecognized key(s) in object: 'turbopack'";
37
- const consoleWarn = console.warn;
38
- console.warn = (...args)=>{
39
- // Force to disable serverExternalPackages warnings: https://github.com/vercel/next.js/issues/68805
40
- if (typeof args[1] === 'string' && args[1].includes(turbopackWarningText) || typeof args[0] === 'string' && args[0].includes(turbopackWarningText)) {
41
- return;
42
- }
43
- // Add Payload-specific message after turbopack config warning in Next.js 15.2.x or lower.
44
- // TODO 4.0: Remove this once we drop support for Next.js 15.2.x
45
- const hasTurbopackConfigWarning = typeof args[1] === 'string' && args[1].includes(turbopackConfigWarningText) || typeof args[0] === 'string' && args[0].includes(turbopackConfigWarningText);
46
- if (hasTurbopackConfigWarning) {
47
- consoleWarn(...args);
48
- consoleWarn('Payload: You can safely ignore the "Invalid next.config" warning above. This only occurs on Next.js 15.2.x or lower. We recommend upgrading to Next.js 15.4.7 to resolve this warning.');
49
- return;
50
- }
51
- consoleWarn(...args);
52
- };
33
+ var SEMVER_REGEXP = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-z-][0-9a-z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-z-][0-9a-z-]*))*))?(?:\+([0-9a-z-]+(?:\.[0-9a-z-]+)*))?$/i;
34
+ function parseSemver(input) {
35
+ const match = input.match(SEMVER_REGEXP) || [];
36
+ const major = _parseInt(match[1]);
37
+ const minor = _parseInt(match[2]);
38
+ const patch = _parseInt(match[3]);
39
+ const prerelease = match[4];
40
+ const canaryVersion = prerelease?.startsWith("canary.") ? parseInt(prerelease.split(".")[1] || "0", 10) : void 0;
41
+ return {
42
+ buildmetadata: match[5],
43
+ canaryVersion,
44
+ major: isNaN(major) ? void 0 : major,
45
+ minor: isNaN(minor) ? void 0 : minor,
46
+ patch: isNaN(patch) ? void 0 : patch,
47
+ prerelease: match[4]
48
+ };
49
+ }
50
+ function getNextjsVersion() {
51
+ try {
52
+ const pkgUrl = import_meta.resolve("next/package.json");
53
+ const pkgJson = JSON.parse((0, import_fs.readFileSync)(new URL(pkgUrl), "utf8"));
54
+ return parseSemver(pkgJson.version);
55
+ } catch {
56
+ return void 0;
57
+ }
58
+ }
59
+ function supportsTurbopackExternalizeTransitiveDependencies(version) {
60
+ if (!version) {
61
+ return false;
62
+ }
63
+ const {
64
+ canaryVersion,
65
+ major,
66
+ minor
67
+ } = version;
68
+ if (major === void 0 || minor === void 0) {
69
+ return false;
70
+ }
71
+ if (major > 16) {
72
+ return true;
73
+ }
74
+ if (major === 16) {
75
+ if (minor > 1) {
76
+ return true;
53
77
  }
54
- const isBuild = process.env.NODE_ENV === 'production';
55
- const isTurbopackNextjs15 = process.env.TURBOPACK === '1';
56
- const isTurbopackNextjs16 = process.env.TURBOPACK === 'auto';
57
- if (isBuild && (isTurbopackNextjs15 || isTurbopackNextjs16)) {
58
- throw new Error('Payload does not support using Turbopack for production builds. If you are using Next.js 16, please use `next build --webpack` instead.');
78
+ if (minor === 1) {
79
+ if (canaryVersion !== void 0) {
80
+ return canaryVersion >= 15;
81
+ } else {
82
+ return true;
83
+ }
59
84
  }
60
- const poweredByHeader = {
61
- key: 'X-Powered-By',
62
- value: 'Next.js, Payload'
85
+ }
86
+ return false;
87
+ }
88
+
89
+ // dist/withPayload/withPayloadLegacy.js
90
+ var withPayloadLegacy = (nextConfig = {}) => {
91
+ if (process.env.PAYLOAD_PATCH_TURBOPACK_WARNINGS !== "false") {
92
+ const turbopackWarningText = "Packages that should be external need to be installed in the project directory, so they can be resolved from the output files.\nTry to install it into the project directory by running";
93
+ const turbopackConfigWarningText = "Unrecognized key(s) in object: 'turbopack'";
94
+ const consoleWarn = console.warn;
95
+ console.warn = (...args) => {
96
+ if (typeof args[1] === "string" && args[1].includes(turbopackWarningText) || typeof args[0] === "string" && args[0].includes(turbopackWarningText)) {
97
+ return;
98
+ }
99
+ const hasTurbopackConfigWarning = typeof args[1] === "string" && args[1].includes(turbopackConfigWarningText) || typeof args[0] === "string" && args[0].includes(turbopackConfigWarningText);
100
+ if (hasTurbopackConfigWarning) {
101
+ consoleWarn(...args);
102
+ consoleWarn('Payload: You can safely ignore the "Invalid next.config" warning above. This only occurs on Next.js 15.2.x or lower. We recommend upgrading to Next.js 15.4.7 to resolve this warning.');
103
+ return;
104
+ }
105
+ consoleWarn(...args);
63
106
  };
64
- /**
65
- * @type {import('next').NextConfig}
66
- */ const toReturn = {
67
- ...nextConfig,
68
- env,
69
- turbopack: {
70
- ...nextConfig.turbopack || {}
71
- },
72
- outputFileTracingExcludes: {
73
- ...nextConfig.outputFileTracingExcludes || {},
74
- '**/*': [
75
- ...nextConfig.outputFileTracingExcludes?.['**/*'] || [],
76
- 'drizzle-kit',
77
- 'drizzle-kit/api'
78
- ]
79
- },
80
- outputFileTracingIncludes: {
81
- ...nextConfig.outputFileTracingIncludes || {},
82
- '**/*': [
83
- ...nextConfig.outputFileTracingIncludes?.['**/*'] || [],
84
- '@libsql/client'
85
- ]
86
- },
87
- // We disable the poweredByHeader here because we add it manually in the headers function below
88
- ...nextConfig.poweredByHeader !== false ? {
89
- poweredByHeader: false
90
- } : {},
91
- headers: async ()=>{
92
- const headersFromConfig = 'headers' in nextConfig ? await nextConfig.headers() : [];
93
- return [
94
- ...headersFromConfig || [],
95
- {
96
- source: '/:path*',
97
- headers: [
98
- {
99
- key: 'Accept-CH',
100
- value: 'Sec-CH-Prefers-Color-Scheme'
101
- },
102
- {
103
- key: 'Vary',
104
- value: 'Sec-CH-Prefers-Color-Scheme'
105
- },
106
- {
107
- key: 'Critical-CH',
108
- value: 'Sec-CH-Prefers-Color-Scheme'
109
- },
110
- ...nextConfig.poweredByHeader !== false ? [
111
- poweredByHeader
112
- ] : []
113
- ]
114
- }
115
- ];
116
- },
117
- serverExternalPackages: [
118
- // serverExternalPackages = webpack.externals, but with turbopack support and an additional check
119
- // for whether the package is resolvable from the project root
120
- ...nextConfig.serverExternalPackages || [],
121
- // Can be externalized, because we require users to install graphql themselves - we only rely on it as a peer dependency => resolvable from the project root.
122
- //
123
- // WHY: without externalizing graphql, a graphql version error will be thrown
124
- // during runtime ("Ensure that there is only one instance of \"graphql\" in the node_modules\ndirectory.")
125
- 'graphql',
126
- // External, because it installs import-in-the-middle and require-in-the-middle - both in the default serverExternalPackages list.
127
- '@sentry/nextjs',
128
- ...process.env.NODE_ENV === 'development' && options.devBundleServerPackages !== true ? /**
129
- * Unless explicitly disabled by the user, by passing `devBundleServerPackages: true` to withPayload, we
130
- * do not bundle server-only packages during dev for two reasons:
131
- *
132
- * 1. Performance: Fewer files to compile means faster compilation speeds.
133
- * 2. Turbopack support: Webpack's externals are not supported by Turbopack.
134
- *
135
- * Regarding Turbopack support: Unlike webpack.externals, we cannot use serverExternalPackages to
136
- * externalized packages that are not resolvable from the project root. So including a package like
137
- * "drizzle-kit" in here would do nothing - Next.js will ignore the rule and still bundle the package -
138
- * because it detects that the package is not resolvable from the project root (= not directly installed
139
- * by the user in their own package.json).
140
- *
141
- * Instead, we can use serverExternalPackages for the entry-point packages that *are* installed directly
142
- * by the user (e.g. db-postgres, which then installs drizzle-kit as a dependency).
143
- *
144
- *
145
- *
146
- * We should only do this during development, not build, because externalizing these packages can hurt
147
- * the bundle size. Not only does it disable tree-shaking, it also risks installing duplicate copies of the
148
- * same package.
149
- *
150
- * Example:
151
- * - @payloadcms/richtext-lexical (in bundle) -> installs qs-esm (bundled because of importer)
152
- * - payload (not in bundle, external) -> installs qs-esm (external because of importer)
153
- * Result: we have two copies of qs-esm installed - one in the bundle, and one in node_modules.
154
- *
155
- * During development, these bundle size difference do not matter much, and development speed /
156
- * turbopack support are more important.
157
- */ [
158
- 'payload',
159
- '@payloadcms/db-mongodb',
160
- '@payloadcms/db-postgres',
161
- '@payloadcms/db-sqlite',
162
- '@payloadcms/db-vercel-postgres',
163
- '@payloadcms/db-d1-sqlite',
164
- '@payloadcms/drizzle',
165
- '@payloadcms/email-nodemailer',
166
- '@payloadcms/email-resend',
167
- '@payloadcms/graphql',
168
- '@payloadcms/payload-cloud',
169
- '@payloadcms/plugin-redirects'
170
- ] : []
107
+ }
108
+ const isBuild = process.env.NODE_ENV === "production";
109
+ const isTurbopackNextjs15 = process.env.TURBOPACK === "1";
110
+ const isTurbopackNextjs16 = process.env.TURBOPACK === "auto";
111
+ if (isBuild && (isTurbopackNextjs15 || isTurbopackNextjs16)) {
112
+ throw new Error("Your Next.js and Payload versions do not support using Turbopack for production builds. Please upgrade to Next.js 16.1.0-canary.15 or higher if you want to use Turbopack for builds.");
113
+ }
114
+ const toReturn = {
115
+ ...nextConfig,
116
+ serverExternalPackages: [
117
+ // serverExternalPackages = webpack.externals, but with turbopack support and an additional check
118
+ // for whether the package is resolvable from the project root
119
+ ...nextConfig.serverExternalPackages || [],
120
+ // External, because it installs import-in-the-middle and require-in-the-middle - both in the default serverExternalPackages list.
121
+ "@sentry/nextjs"
122
+ ]
123
+ };
124
+ return toReturn;
125
+ };
126
+
127
+ // dist/withPayload/withPayload.js
128
+ var poweredByHeader = {
129
+ key: "X-Powered-By",
130
+ value: "Next.js, Payload"
131
+ };
132
+ var withPayload = (nextConfig = {}, options = {}) => {
133
+ const nextjsVersion = getNextjsVersion();
134
+ const supportsTurbopackBuild = supportsTurbopackExternalizeTransitiveDependencies(nextjsVersion);
135
+ const env = nextConfig.env || {};
136
+ if (nextConfig.experimental?.staleTimes?.dynamic) {
137
+ console.warn("Payload detected a non-zero value for the `staleTimes.dynamic` option in your Next.js config. This will slow down page transitions and may cause stale data to load within the Admin panel. To clear this warning, remove the `staleTimes.dynamic` option from your Next.js config or set it to 0. In the future, Next.js may support scoping this option to specific routes.");
138
+ env.NEXT_PUBLIC_ENABLE_ROUTER_CACHE_REFRESH = "true";
139
+ }
140
+ const baseConfig = {
141
+ ...nextConfig,
142
+ env,
143
+ outputFileTracingExcludes: {
144
+ ...nextConfig.outputFileTracingExcludes || {},
145
+ "**/*": [...nextConfig.outputFileTracingExcludes?.["**/*"] || [], "drizzle-kit", "drizzle-kit/api"]
146
+ },
147
+ outputFileTracingIncludes: {
148
+ ...nextConfig.outputFileTracingIncludes || {},
149
+ "**/*": [...nextConfig.outputFileTracingIncludes?.["**/*"] || [], "@libsql/client"]
150
+ },
151
+ turbopack: {
152
+ ...nextConfig.turbopack || {}
153
+ },
154
+ // We disable the poweredByHeader here because we add it manually in the headers function below
155
+ ...nextConfig.poweredByHeader !== false ? {
156
+ poweredByHeader: false
157
+ } : {},
158
+ headers: async () => {
159
+ const headersFromConfig = "headers" in nextConfig ? await nextConfig.headers() : [];
160
+ return [...headersFromConfig || [], {
161
+ headers: [{
162
+ key: "Accept-CH",
163
+ value: "Sec-CH-Prefers-Color-Scheme"
164
+ }, {
165
+ key: "Vary",
166
+ value: "Sec-CH-Prefers-Color-Scheme"
167
+ }, {
168
+ key: "Critical-CH",
169
+ value: "Sec-CH-Prefers-Color-Scheme"
170
+ }, ...nextConfig.poweredByHeader !== false ? [poweredByHeader] : []],
171
+ source: "/:path*"
172
+ }];
173
+ },
174
+ serverExternalPackages: [
175
+ // WHY: without externalizing graphql, a graphql version error will be thrown
176
+ // during runtime ("Ensure that there is only one instance of \"graphql\" in the node_modules\ndirectory.")
177
+ "graphql",
178
+ ...process.env.NODE_ENV === "development" && options.devBundleServerPackages !== true ? (
179
+ /**
180
+ * Unless explicitly disabled by the user, by passing `devBundleServerPackages: true` to withPayload, we
181
+ * do not bundle server-only packages during dev for two reasons:
182
+ *
183
+ * 1. Performance: Fewer files to compile means faster compilation speeds.
184
+ * 2. Turbopack support: Webpack's externals are not supported by Turbopack.
185
+ *
186
+ * Regarding Turbopack support: Unlike webpack.externals, we cannot use serverExternalPackages to
187
+ * externalized packages that are not resolvable from the project root. So including a package like
188
+ * "drizzle-kit" in here would do nothing - Next.js will ignore the rule and still bundle the package -
189
+ * because it detects that the package is not resolvable from the project root (= not directly installed
190
+ * by the user in their own package.json).
191
+ *
192
+ * Instead, we can use serverExternalPackages for the entry-point packages that *are* installed directly
193
+ * by the user (e.g. db-postgres, which then installs drizzle-kit as a dependency).
194
+ *
195
+ *
196
+ *
197
+ * We should only do this during development, not build, because externalizing these packages can hurt
198
+ * the bundle size. Not only does it disable tree-shaking, it also risks installing duplicate copies of the
199
+ * same package.
200
+ *
201
+ * Example:
202
+ * - @payloadcms/richtext-lexical (in bundle) -> installs qs-esm (bundled because of importer)
203
+ * - payload (not in bundle, external) -> installs qs-esm (external because of importer)
204
+ * Result: we have two copies of qs-esm installed - one in the bundle, and one in node_modules.
205
+ *
206
+ * During development, these bundle size difference do not matter much, and development speed /
207
+ * turbopack support are more important.
208
+ */
209
+ ["payload", "@payloadcms/db-mongodb", "@payloadcms/db-postgres", "@payloadcms/db-sqlite", "@payloadcms/db-vercel-postgres", "@payloadcms/db-d1-sqlite", "@payloadcms/drizzle", "@payloadcms/email-nodemailer", "@payloadcms/email-resend", "@payloadcms/graphql", "@payloadcms/payload-cloud", "@payloadcms/plugin-redirects"]
210
+ ) : []
211
+ ],
212
+ webpack: (webpackConfig, webpackOptions) => {
213
+ const incomingWebpackConfig = typeof nextConfig.webpack === "function" ? nextConfig.webpack(webpackConfig, webpackOptions) : webpackConfig;
214
+ return {
215
+ ...incomingWebpackConfig,
216
+ externals: [
217
+ ...incomingWebpackConfig?.externals || [],
218
+ /**
219
+ * See the explanation in the serverExternalPackages section above.
220
+ * We need to force Webpack to emit require() calls for these packages, even though they are not
221
+ * resolvable from the project root. You would expect this to error during runtime, but Next.js seems to be able to require these just fine.
222
+ *
223
+ * This is the only way to get Webpack Build to work, without the bundle size caveats of externalizing the
224
+ * entry point packages, as explained in the serverExternalPackages section above.
225
+ */
226
+ "drizzle-kit",
227
+ "drizzle-kit/api",
228
+ "sharp",
229
+ "libsql",
230
+ "require-in-the-middle"
171
231
  ],
172
- webpack: (webpackConfig, webpackOptions)=>{
173
- const incomingWebpackConfig = typeof nextConfig.webpack === 'function' ? nextConfig.webpack(webpackConfig, webpackOptions) : webpackConfig;
174
- return {
175
- ...incomingWebpackConfig,
176
- externals: [
177
- ...incomingWebpackConfig?.externals || [],
178
- /**
179
- * See the explanation in the serverExternalPackages section above.
180
- * We need to force Webpack to emit require() calls for these packages, even though they are not
181
- * resolvable from the project root. You would expect this to error during runtime, but Next.js seems to be able to require these just fine.
182
- *
183
- * This is the only way to get Webpack Build to work, without the bundle size caveats of externalizing the
184
- * entry point packages, as explained in the serverExternalPackages section above.
185
- */ 'drizzle-kit',
186
- 'drizzle-kit/api',
187
- 'sharp',
188
- 'libsql',
189
- 'require-in-the-middle'
190
- ],
191
- resolve: {
192
- ...incomingWebpackConfig?.resolve || {},
193
- alias: {
194
- ...incomingWebpackConfig?.resolve?.alias || {}
195
- },
196
- fallback: {
197
- ...incomingWebpackConfig?.resolve?.fallback || {},
198
- /*
199
- * This fixes the following warning when running next build with webpack (tested on Next.js 16.0.3 with Payload 3.64.0):
200
- *
201
- * ⚠ Compiled with warnings in 8.7s
202
- *
203
- * ./node_modules/.pnpm/mongodb@6.16.0/node_modules/mongodb/lib/deps.js
204
- * Module not found: Can't resolve 'aws4' in '/Users/alessio/Documents/temp/next16p/node_modules/.pnpm/mongodb@6.16.0/node_modules/mongodb/lib'
205
- *
206
- * Import trace for requested module:
207
- * ./node_modules/.pnpm/mongodb@6.16.0/node_modules/mongodb/lib/deps.js
208
- * ./node_modules/.pnpm/mongodb@6.16.0/node_modules/mongodb/lib/client-side-encryption/client_encryption.js
209
- * ./node_modules/.pnpm/mongodb@6.16.0/node_modules/mongodb/lib/index.js
210
- * ./node_modules/.pnpm/mongoose@8.15.1/node_modules/mongoose/lib/index.js
211
- * ./node_modules/.pnpm/mongoose@8.15.1/node_modules/mongoose/index.js
212
- * ./node_modules/.pnpm/@payloadcms+db-mongodb@3.64.0_payload@3.64.0_graphql@16.12.0_typescript@5.7.3_/node_modules/@payloadcms/db-mongodb/dist/index.js
213
- * ./src/payload.config.ts
214
- * ./src/app/my-route/route.ts
215
- *
216
- **/ aws4: false
217
- }
218
- },
219
- plugins: [
220
- ...incomingWebpackConfig?.plugins || [],
221
- // Fix cloudflare:sockets error: https://github.com/vercel/next.js/discussions/50177
222
- new webpackOptions.webpack.IgnorePlugin({
223
- resourceRegExp: /^pg-native$|^cloudflare:sockets$/
224
- })
225
- ]
226
- };
232
+ plugins: [
233
+ ...incomingWebpackConfig?.plugins || [],
234
+ // Fix cloudflare:sockets error: https://github.com/vercel/next.js/discussions/50177
235
+ new webpackOptions.webpack.IgnorePlugin({
236
+ resourceRegExp: /^pg-native$|^cloudflare:sockets$/
237
+ })
238
+ ],
239
+ resolve: {
240
+ ...incomingWebpackConfig?.resolve || {},
241
+ alias: {
242
+ ...incomingWebpackConfig?.resolve?.alias || {}
243
+ },
244
+ fallback: {
245
+ ...incomingWebpackConfig?.resolve?.fallback || {},
246
+ /*
247
+ * This fixes the following warning when running next build with webpack (tested on Next.js 16.0.3 with Payload 3.64.0):
248
+ *
249
+ * ⚠ Compiled with warnings in 8.7s
250
+ *
251
+ * ./node_modules/.pnpm/mongodb@6.16.0/node_modules/mongodb/lib/deps.js
252
+ * Module not found: Can't resolve 'aws4' in '/Users/alessio/Documents/temp/next16p/node_modules/.pnpm/mongodb@6.16.0/node_modules/mongodb/lib'
253
+ *
254
+ * Import trace for requested module:
255
+ * ./node_modules/.pnpm/mongodb@6.16.0/node_modules/mongodb/lib/deps.js
256
+ * ./node_modules/.pnpm/mongodb@6.16.0/node_modules/mongodb/lib/client-side-encryption/client_encryption.js
257
+ * ./node_modules/.pnpm/mongodb@6.16.0/node_modules/mongodb/lib/index.js
258
+ * ./node_modules/.pnpm/mongoose@8.15.1/node_modules/mongoose/lib/index.js
259
+ * ./node_modules/.pnpm/mongoose@8.15.1/node_modules/mongoose/index.js
260
+ * ./node_modules/.pnpm/@payloadcms+db-mongodb@3.64.0_payload@3.64.0_graphql@16.12.0_typescript@5.7.3_/node_modules/@payloadcms/db-mongodb/dist/index.js
261
+ * ./src/payload.config.ts
262
+ * ./src/app/my-route/route.ts
263
+ *
264
+ **/
265
+ aws4: false
266
+ }
227
267
  }
228
- };
229
- if (nextConfig.basePath) {
230
- toReturn.env.NEXT_BASE_PATH = nextConfig.basePath;
268
+ };
231
269
  }
232
- return toReturn;
270
+ };
271
+ if (nextConfig.basePath) {
272
+ baseConfig.env.NEXT_BASE_PATH = nextConfig.basePath;
273
+ }
274
+ if (!supportsTurbopackBuild) {
275
+ return withPayloadLegacy(baseConfig);
276
+ } else {
277
+ return {
278
+ ...baseConfig,
279
+ serverExternalPackages: [
280
+ ...baseConfig.serverExternalPackages || [],
281
+ "drizzle-kit",
282
+ "drizzle-kit/api",
283
+ "sharp",
284
+ "libsql",
285
+ "require-in-the-middle",
286
+ // Prevents turbopack build errors by the thread-stream package which is installed by pino
287
+ "pino"
288
+ ]
289
+ };
290
+ }
233
291
  };
234
- const _default = withPayload;
235
-
236
-
237
- //# sourceMappingURL=withPayload.cjs.map
292
+ var withPayload_default = withPayload;
293
+ // Annotate the CommonJS export names for ESM import in node:
294
+ 0 && (module.exports = {
295
+ withPayload
296
+ });
297
+ //# sourceMappingURL=withPayload.cjs.map