@payloadcms/next 3.63.0-canary.4 → 3.63.0-internal.0bf4b7f

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.
@@ -23,22 +23,11 @@ _export(exports, {
23
23
  }
24
24
  });
25
25
  const withPayload = (nextConfig = {}, options = {})=>{
26
- const env = nextConfig?.env || {};
26
+ const env = nextConfig.env || {};
27
27
  if (nextConfig.experimental?.staleTimes?.dynamic) {
28
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
29
  env.NEXT_PUBLIC_ENABLE_ROUTER_CACHE_REFRESH = 'true';
30
30
  }
31
- if (process.env.PAYLOAD_PATCH_TURBOPACK_WARNINGS !== 'false') {
32
- 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';
33
- const consoleWarn = console.warn;
34
- console.warn = (...args)=>{
35
- // Force to disable serverExternalPackages warnings: https://github.com/vercel/next.js/issues/68805
36
- if (typeof args[1] === 'string' && args[1].includes(turbopackWarningText) || typeof args[0] === 'string' && args[0].includes(turbopackWarningText)) {
37
- return;
38
- }
39
- consoleWarn(...args);
40
- };
41
- }
42
31
  const poweredByHeader = {
43
32
  key: 'X-Powered-By',
44
33
  value: 'Next.js, Payload'
@@ -48,23 +37,26 @@ const withPayload = (nextConfig = {}, options = {})=>{
48
37
  */ const toReturn = {
49
38
  ...nextConfig,
50
39
  env,
40
+ turbopack: {
41
+ ...nextConfig.turbopack || {}
42
+ },
51
43
  outputFileTracingExcludes: {
52
- ...nextConfig?.outputFileTracingExcludes || {},
44
+ ...nextConfig.outputFileTracingExcludes || {},
53
45
  '**/*': [
54
- ...nextConfig?.outputFileTracingExcludes?.['**/*'] || [],
46
+ ...nextConfig.outputFileTracingExcludes?.['**/*'] || [],
55
47
  'drizzle-kit',
56
48
  'drizzle-kit/api'
57
49
  ]
58
50
  },
59
51
  outputFileTracingIncludes: {
60
- ...nextConfig?.outputFileTracingIncludes || {},
52
+ ...nextConfig.outputFileTracingIncludes || {},
61
53
  '**/*': [
62
- ...nextConfig?.outputFileTracingIncludes?.['**/*'] || [],
54
+ ...nextConfig.outputFileTracingIncludes?.['**/*'] || [],
63
55
  '@libsql/client'
64
56
  ]
65
57
  },
66
58
  // We disable the poweredByHeader here because we add it manually in the headers function below
67
- ...nextConfig?.poweredByHeader !== false ? {
59
+ ...nextConfig.poweredByHeader !== false ? {
68
60
  poweredByHeader: false
69
61
  } : {},
70
62
  headers: async ()=>{
@@ -86,7 +78,7 @@ const withPayload = (nextConfig = {}, options = {})=>{
86
78
  key: 'Critical-CH',
87
79
  value: 'Sec-CH-Prefers-Color-Scheme'
88
80
  },
89
- ...nextConfig?.poweredByHeader !== false ? [
81
+ ...nextConfig.poweredByHeader !== false ? [
90
82
  poweredByHeader
91
83
  ] : []
92
84
  ]
@@ -94,25 +86,32 @@ const withPayload = (nextConfig = {}, options = {})=>{
94
86
  ];
95
87
  },
96
88
  serverExternalPackages: [
97
- ...nextConfig?.serverExternalPackages || [],
98
- 'drizzle-kit',
99
- 'drizzle-kit/api',
100
- 'pino',
101
- 'libsql',
102
- 'pino-pretty',
103
- 'graphql',
104
- // Do not bundle server-only packages during dev to improve compile speed
89
+ ...nextConfig.serverExternalPackages || [],
90
+ // These packages always need to be external, both during dev and production. This is because they install dependencies
91
+ // that will error when trying to bundle them (e.g. drizzle-kit, libsql, esbuild etc.).
92
+ // We cannot externalize those problem-packages directly. We can only externalize packages that are manually installed
93
+ // by the end user. Otherwise, the require('externalPackage') calls generated by the bundler would fail during runtime,
94
+ // as you cannot import dependencies of dependencies in a lot of package managers like pnpm. We'd have to force users
95
+ // to install the dependencies directly.
96
+ // Thus, we externalize the "entry-point" = the package that is installed by the end user, which would be our db adapters.
97
+ //
98
+ //
99
+ // External because it installs mongoose (part of default serverExternalPackages: https://github.com/vercel/next.js/blob/canary/packages/next/src/lib/server-external-packages.json => would throw warning if we don't exclude the entry-point package):
100
+ '@payloadcms/db-mongodb',
101
+ // External because they install dependencies like drizzle, libsql, esbuild etc.:
102
+ '@payloadcms/db-postgres',
103
+ '@payloadcms/db-sqlite',
104
+ '@payloadcms/db-vercel-postgres',
105
+ '@payloadcms/drizzle',
106
+ // External because they install @aws-sdk/client-s3:
107
+ '@payloadcms/payload-cloud',
108
+ // TODO: We need to externalize @payloadcms/storage-s3 as well, once Next.js has the ability to exclude @payloadcms/storage-s3/client from being externalized.
109
+ // Do not bundle additional server-only packages during dev to improve compilation speed
105
110
  ...process.env.NODE_ENV === 'development' && options.devBundleServerPackages === false ? [
106
111
  'payload',
107
- '@payloadcms/db-mongodb',
108
- '@payloadcms/db-postgres',
109
- '@payloadcms/db-sqlite',
110
- '@payloadcms/db-vercel-postgres',
111
- '@payloadcms/drizzle',
112
112
  '@payloadcms/email-nodemailer',
113
113
  '@payloadcms/email-resend',
114
114
  '@payloadcms/graphql',
115
- '@payloadcms/payload-cloud',
116
115
  '@payloadcms/plugin-redirects'
117
116
  ] : []
118
117
  ],
@@ -122,51 +121,15 @@ const withPayload = (nextConfig = {}, options = {})=>{
122
121
  ...incomingWebpackConfig,
123
122
  externals: [
124
123
  ...incomingWebpackConfig?.externals || [],
125
- 'drizzle-kit',
126
- 'drizzle-kit/api',
127
- 'sharp',
128
- 'libsql',
129
124
  'require-in-the-middle'
130
125
  ],
131
- ignoreWarnings: [
132
- ...incomingWebpackConfig?.ignoreWarnings || [],
133
- {
134
- module: /node_modules\/mongodb\/lib\/utils\.js/
135
- },
136
- {
137
- file: /node_modules\/mongodb\/lib\/utils\.js/
138
- },
139
- {
140
- module: /node_modules\/mongodb\/lib\/bson\.js/
141
- },
142
- {
143
- file: /node_modules\/mongodb\/lib\/bson\.js/
144
- }
145
- ],
146
126
  plugins: [
147
127
  ...incomingWebpackConfig?.plugins || [],
148
128
  // Fix cloudflare:sockets error: https://github.com/vercel/next.js/discussions/50177
149
129
  new webpackOptions.webpack.IgnorePlugin({
150
130
  resourceRegExp: /^pg-native$|^cloudflare:sockets$/
151
131
  })
152
- ],
153
- resolve: {
154
- ...incomingWebpackConfig?.resolve || {},
155
- alias: {
156
- ...incomingWebpackConfig?.resolve?.alias || {}
157
- },
158
- fallback: {
159
- ...incomingWebpackConfig?.resolve?.fallback || {},
160
- '@aws-sdk/credential-providers': false,
161
- '@mongodb-js/zstd': false,
162
- aws4: false,
163
- kerberos: false,
164
- 'mongodb-client-encryption': false,
165
- snappy: false,
166
- 'supports-color': false,
167
- 'yocto-queue': false
168
- }
169
- }
132
+ ]
170
133
  };
171
134
  }
172
135
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/withPayload.js"],"names":["withPayload","nextConfig","options","env","experimental","staleTimes","dynamic","console","warn","NEXT_PUBLIC_ENABLE_ROUTER_CACHE_REFRESH","process","PAYLOAD_PATCH_TURBOPACK_WARNINGS","turbopackWarningText","consoleWarn","args","includes","poweredByHeader","key","value","toReturn","outputFileTracingExcludes","outputFileTracingIncludes","headers","headersFromConfig","source","serverExternalPackages","NODE_ENV","devBundleServerPackages","webpack","webpackConfig","webpackOptions","incomingWebpackConfig","externals","ignoreWarnings","module","file","plugins","IgnorePlugin","resourceRegExp","resolve","alias","fallback","aws4","kerberos","snappy","basePath","NEXT_BASE_PATH"],"mappings":"AAAA;;;;;;GAMG;;;;;;;;;;;QA4KH;eAAA;;QA3KaA;eAAAA;;;AAAN,MAAMA,cAAc,CAACC,aAAa,CAAC,CAAC,EAAEC,UAAU,CAAC,CAAC;IACvD,MAAMC,MAAMF,YAAYE,OAAO,CAAC;IAEhC,IAAIF,WAAWG,YAAY,EAAEC,YAAYC,SAAS;QAChDC,QAAQC,IAAI,CACV;QAEFL,IAAIM,uCAAuC,GAAG;IAChD;IAEA,IAAIC,QAAQP,GAAG,CAACQ,gCAAgC,KAAK,SAAS;QAC5D,M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ACA,yEAAyE;eACrEf,QAAQP,GAAG,CAACuB,QAAQ,KAAK,iBAAiBxB,QAAQyB,uBAAuB,KAAK,QAC9E;gBACE;gBACA;gBACA;gBACA;gBACA;gBACA;gBACA;gBACA;gBACA;gBACA;gBACA;aAWD,GACD,EAAE;SACP;QACDC,SAAS,CAACC,eAAeC;YACvB,MAAMC,wBACJ,OAAO9B,WAAW2B,OAAO,KAAK,aAC1B3B,WAAW2B,OAAO,CAACC,eAAeC,kBAClCD;YAEN,OAAO;gBACL,GAAGE,qBAAqB;gBACxBC,WAAW;uBACLD,uBAAuBC,aAAa,EAAE;oBAC1C;oBACA;oBACA;oBACA;oBACA;iBACD;gBACDC,gBAAgB;uBACVF,uBAAuBE,kBAAkB,EAAE;oBAC/C;wBAAEC,QAAQ;oBAAwC;oBAClD;wBAAEC,MAAM;oBAAwC;oBAChD;wBAAED,QAAQ;oBAAuC;oBACjD;wBAAEC,MAAM;oBAAuC;iBAChD;gBACDC,SAAS;uBACHL,uBAAuBK,WAAW,EAAE;oBACxC,oFAAoF;oBACpF,IAAIN,eAAeF,OAAO,CAACS,YAAY,CAAC;wBACtCC,gBAAgB;oBAClB;iBACD;gBACDC,SAAS;oBACP,GAAIR,uBAAuBQ,WAAW,CAAC,CAAC;oBACxCC,OAAO;wBACL,GAAIT,uBAAuBQ,SAASC,SAAS,CAAC,CAAC;oBACjD;oBACAC,UAAU;wBACR,GAAIV,uBAAuBQ,SAASE,YAAY,CAAC,CAAC;wBAClD,iCAAiC;wBACjC,oBAAoB;wBACpBC,MAAM;wBACNC,UAAU;wBACV,6BAA6B;wBAC7BC,QAAQ;wBACR,kBAAkB;wBAClB,eAAe;oBACjB;gBACF;YACF;QACF;IACF;IAEA,IAAI3C,WAAW4C,QAAQ,EAAE;QACvB1B,SAAShB,GAAG,CAAC2C,cAAc,GAAG7C,WAAW4C,QAAQ;IACnD;IAEA,OAAO1B;AACT;MAEA,WAAenB","file":"withPayload.cjs","sourcesContent":["/**\n * @param {import('next').NextConfig} nextConfig\n * @param {Object} [options] - Optional configuration options\n * @param {boolean} [options.devBundleServerPackages] - Whether to bundle server packages in development mode. @default true\n *\n * @returns {import('next').NextConfig}\n * */\nexport const withPayload = (nextConfig = {}, options = {}) => {\n const env = nextConfig?.env || {}\n\n if (nextConfig.experimental?.staleTimes?.dynamic) {\n console.warn(\n '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.',\n )\n env.NEXT_PUBLIC_ENABLE_ROUTER_CACHE_REFRESH = 'true'\n }\n\n if (process.env.PAYLOAD_PATCH_TURBOPACK_WARNINGS !== 'false') {\n const turbopackWarningText =\n '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'\n\n const consoleWarn = console.warn\n console.warn = (...args) => {\n // Force to disable serverExternalPackages warnings: https://github.com/vercel/next.js/issues/68805\n if (\n (typeof args[1] === 'string' && args[1].includes(turbopackWarningText)) ||\n (typeof args[0] === 'string' && args[0].includes(turbopackWarningText))\n ) {\n return\n }\n\n consoleWarn(...args)\n }\n }\n\n const poweredByHeader = {\n key: 'X-Powered-By',\n value: 'Next.js, Payload',\n }\n\n /**\n * @type {import('next').NextConfig}\n */\n const toReturn = {\n ...nextConfig,\n env,\n outputFileTracingExcludes: {\n ...(nextConfig?.outputFileTracingExcludes || {}),\n '**/*': [\n ...(nextConfig?.outputFileTracingExcludes?.['**/*'] || []),\n 'drizzle-kit',\n 'drizzle-kit/api',\n ],\n },\n outputFileTracingIncludes: {\n ...(nextConfig?.outputFileTracingIncludes || {}),\n '**/*': [...(nextConfig?.outputFileTracingIncludes?.['**/*'] || []), '@libsql/client'],\n },\n // We disable the poweredByHeader here because we add it manually in the headers function below\n ...(nextConfig?.poweredByHeader !== false ? { poweredByHeader: false } : {}),\n headers: async () => {\n const headersFromConfig = 'headers' in nextConfig ? await nextConfig.headers() : []\n\n return [\n ...(headersFromConfig || []),\n {\n source: '/:path*',\n headers: [\n {\n key: 'Accept-CH',\n value: 'Sec-CH-Prefers-Color-Scheme',\n },\n {\n key: 'Vary',\n value: 'Sec-CH-Prefers-Color-Scheme',\n },\n {\n key: 'Critical-CH',\n value: 'Sec-CH-Prefers-Color-Scheme',\n },\n ...(nextConfig?.poweredByHeader !== false ? [poweredByHeader] : []),\n ],\n },\n ]\n },\n serverExternalPackages: [\n ...(nextConfig?.serverExternalPackages || []),\n 'drizzle-kit',\n 'drizzle-kit/api',\n 'pino',\n 'libsql',\n 'pino-pretty',\n 'graphql',\n // Do not bundle server-only packages during dev to improve compile speed\n ...(process.env.NODE_ENV === 'development' && options.devBundleServerPackages === false\n ? [\n 'payload',\n '@payloadcms/db-mongodb',\n '@payloadcms/db-postgres',\n '@payloadcms/db-sqlite',\n '@payloadcms/db-vercel-postgres',\n '@payloadcms/drizzle',\n '@payloadcms/email-nodemailer',\n '@payloadcms/email-resend',\n '@payloadcms/graphql',\n '@payloadcms/payload-cloud',\n '@payloadcms/plugin-redirects',\n // TODO: Add the following packages, excluding their /client subpath exports, once Next.js supports it\n //'@payloadcms/plugin-cloud-storage',\n //'@payloadcms/plugin-sentry',\n //'@payloadcms/plugin-stripe',\n // @payloadcms/richtext-lexical\n //'@payloadcms/storage-azure',\n //'@payloadcms/storage-gcs',\n //'@payloadcms/storage-s3',\n //'@payloadcms/storage-uploadthing',\n //'@payloadcms/storage-vercel-blob',\n ]\n : []),\n ],\n webpack: (webpackConfig, webpackOptions) => {\n const incomingWebpackConfig =\n typeof nextConfig.webpack === 'function'\n ? nextConfig.webpack(webpackConfig, webpackOptions)\n : webpackConfig\n\n return {\n ...incomingWebpackConfig,\n externals: [\n ...(incomingWebpackConfig?.externals || []),\n 'drizzle-kit',\n 'drizzle-kit/api',\n 'sharp',\n 'libsql',\n 'require-in-the-middle',\n ],\n ignoreWarnings: [\n ...(incomingWebpackConfig?.ignoreWarnings || []),\n { module: /node_modules\\/mongodb\\/lib\\/utils\\.js/ },\n { file: /node_modules\\/mongodb\\/lib\\/utils\\.js/ },\n { module: /node_modules\\/mongodb\\/lib\\/bson\\.js/ },\n { file: /node_modules\\/mongodb\\/lib\\/bson\\.js/ },\n ],\n plugins: [\n ...(incomingWebpackConfig?.plugins || []),\n // Fix cloudflare:sockets error: https://github.com/vercel/next.js/discussions/50177\n new webpackOptions.webpack.IgnorePlugin({\n resourceRegExp: /^pg-native$|^cloudflare:sockets$/,\n }),\n ],\n resolve: {\n ...(incomingWebpackConfig?.resolve || {}),\n alias: {\n ...(incomingWebpackConfig?.resolve?.alias || {}),\n },\n fallback: {\n ...(incomingWebpackConfig?.resolve?.fallback || {}),\n '@aws-sdk/credential-providers': false,\n '@mongodb-js/zstd': false,\n aws4: false,\n kerberos: false,\n 'mongodb-client-encryption': false,\n snappy: false,\n 'supports-color': false,\n 'yocto-queue': false,\n },\n },\n }\n },\n }\n\n if (nextConfig.basePath) {\n toReturn.env.NEXT_BASE_PATH = nextConfig.basePath\n }\n\n return toReturn\n}\n\nexport default withPayload\n"]}
1
+ {"version":3,"sources":["../../src/withPayload.js"],"names":["withPayload","nextConfig","options","env","experimental","staleTimes","dynamic","console","warn","NEXT_PUBLIC_ENABLE_ROUTER_CACHE_REFRESH","poweredByHeader","key","value","toReturn","turbopack","outputFileTracingExcludes","outputFileTracingIncludes","headers","headersFromConfig","source","serverExternalPackages","process","NODE_ENV","devBundleServerPackages","webpack","webpackConfig","webpackOptions","incomingWebpackConfig","externals","plugins","IgnorePlugin","resourceRegExp","basePath","NEXT_BASE_PATH"],"mappings":"AAAA;;;;;;GAMG;;;;;;;;;;;QAqIH;eAAA;;QApIaA;eAAAA;;;AAAN,MAAMA,cAAc,CAACC,aAAa,CAAC,CAAC,EAAEC,UAAU,CAAC,CAAC;IACvD,MAAMC,MAAMF,WAAWE,GAAG,IAAI,CAAC;IAE/B,IAAIF,WAAWG,YAAY,EAAEC,YAAYC,S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A,8JAA8J;YAC9J,wFAAwF;eACpFC,QAAQlB,GAAG,CAACmB,QAAQ,KAAK,iBAAiBpB,QAAQqB,uBAAuB,KAAK,QAC9E;gBACE;gBACA;gBACA;gBACA;gBACA;aAWD,GACD,EAAE;SACP;QACDC,SAAS,CAACC,eAAeC;YACvB,MAAMC,wBACJ,OAAO1B,WAAWuB,OAAO,KAAK,aAC1BvB,WAAWuB,OAAO,CAACC,eAAeC,kBAClCD;YAEN,OAAO;gBACL,GAAGE,qBAAqB;gBACxBC,WAAW;uBAAKD,uBAAuBC,aAAa,EAAE;oBAAG;iBAAwB;gBACjFC,SAAS;uBACHF,uBAAuBE,WAAW,EAAE;oBACxC,oFAAoF;oBACpF,IAAIH,eAAeF,OAAO,CAACM,YAAY,CAAC;wBACtCC,gBAAgB;oBAClB;iBACD;YACH;QACF;IACF;IAEA,IAAI9B,WAAW+B,QAAQ,EAAE;QACvBnB,SAASV,GAAG,CAAC8B,cAAc,GAAGhC,WAAW+B,QAAQ;IACnD;IAEA,OAAOnB;AACT;MAEA,WAAeb","file":"withPayload.cjs","sourcesContent":["/**\n * @param {import('next').NextConfig} nextConfig\n * @param {Object} [options] - Optional configuration options\n * @param {boolean} [options.devBundleServerPackages] - Whether to bundle server packages in development mode. @default true\n *\n * @returns {import('next').NextConfig}\n * */\nexport const withPayload = (nextConfig = {}, options = {}) => {\n const env = nextConfig.env || {}\n\n if (nextConfig.experimental?.staleTimes?.dynamic) {\n console.warn(\n '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.',\n )\n env.NEXT_PUBLIC_ENABLE_ROUTER_CACHE_REFRESH = 'true'\n }\n\n const poweredByHeader = {\n key: 'X-Powered-By',\n value: 'Next.js, Payload',\n }\n\n /**\n * @type {import('next').NextConfig}\n */\n const toReturn = {\n ...nextConfig,\n env,\n turbopack: {\n ...(nextConfig.turbopack || {}),\n },\n outputFileTracingExcludes: {\n ...(nextConfig.outputFileTracingExcludes || {}),\n '**/*': [\n ...(nextConfig.outputFileTracingExcludes?.['**/*'] || []),\n 'drizzle-kit',\n 'drizzle-kit/api',\n ],\n },\n outputFileTracingIncludes: {\n ...(nextConfig.outputFileTracingIncludes || {}),\n '**/*': [...(nextConfig.outputFileTracingIncludes?.['**/*'] || []), '@libsql/client'],\n },\n // We disable the poweredByHeader here because we add it manually in the headers function below\n ...(nextConfig.poweredByHeader !== false ? { poweredByHeader: false } : {}),\n headers: async () => {\n const headersFromConfig = 'headers' in nextConfig ? await nextConfig.headers() : []\n\n return [\n ...(headersFromConfig || []),\n {\n source: '/:path*',\n headers: [\n {\n key: 'Accept-CH',\n value: 'Sec-CH-Prefers-Color-Scheme',\n },\n {\n key: 'Vary',\n value: 'Sec-CH-Prefers-Color-Scheme',\n },\n {\n key: 'Critical-CH',\n value: 'Sec-CH-Prefers-Color-Scheme',\n },\n ...(nextConfig.poweredByHeader !== false ? [poweredByHeader] : []),\n ],\n },\n ]\n },\n serverExternalPackages: [\n ...(nextConfig.serverExternalPackages || []),\n // These packages always need to be external, both during dev and production. This is because they install dependencies\n // that will error when trying to bundle them (e.g. drizzle-kit, libsql, esbuild etc.).\n // We cannot externalize those problem-packages directly. We can only externalize packages that are manually installed\n // by the end user. Otherwise, the require('externalPackage') calls generated by the bundler would fail during runtime,\n // as you cannot import dependencies of dependencies in a lot of package managers like pnpm. We'd have to force users\n // to install the dependencies directly.\n // Thus, we externalize the \"entry-point\" = the package that is installed by the end user, which would be our db adapters.\n //\n //\n // External because it installs mongoose (part of default serverExternalPackages: https://github.com/vercel/next.js/blob/canary/packages/next/src/lib/server-external-packages.json => would throw warning if we don't exclude the entry-point package):\n '@payloadcms/db-mongodb',\n // External because they install dependencies like drizzle, libsql, esbuild etc.:\n '@payloadcms/db-postgres',\n '@payloadcms/db-sqlite',\n '@payloadcms/db-vercel-postgres',\n '@payloadcms/drizzle',\n // External because they install @aws-sdk/client-s3:\n '@payloadcms/payload-cloud',\n // TODO: We need to externalize @payloadcms/storage-s3 as well, once Next.js has the ability to exclude @payloadcms/storage-s3/client from being externalized.\n // Do not bundle additional server-only packages during dev to improve compilation speed\n ...(process.env.NODE_ENV === 'development' && options.devBundleServerPackages === false\n ? [\n 'payload',\n '@payloadcms/email-nodemailer',\n '@payloadcms/email-resend',\n '@payloadcms/graphql',\n '@payloadcms/plugin-redirects',\n // TODO: Add the following packages, excluding their /client subpath exports, once Next.js supports it\n //'@payloadcms/plugin-cloud-storage',\n //'@payloadcms/plugin-sentry',\n //'@payloadcms/plugin-stripe',\n // @payloadcms/richtext-lexical\n //'@payloadcms/storage-azure',\n //'@payloadcms/storage-gcs',\n //'@payloadcms/storage-s3',\n //'@payloadcms/storage-uploadthing',\n //'@payloadcms/storage-vercel-blob',\n ]\n : []),\n ],\n webpack: (webpackConfig, webpackOptions) => {\n const incomingWebpackConfig =\n typeof nextConfig.webpack === 'function'\n ? nextConfig.webpack(webpackConfig, webpackOptions)\n : webpackConfig\n\n return {\n ...incomingWebpackConfig,\n externals: [...(incomingWebpackConfig?.externals || []), 'require-in-the-middle'],\n plugins: [\n ...(incomingWebpackConfig?.plugins || []),\n // Fix cloudflare:sockets error: https://github.com/vercel/next.js/discussions/50177\n new webpackOptions.webpack.IgnorePlugin({\n resourceRegExp: /^pg-native$|^cloudflare:sockets$/,\n }),\n ],\n }\n },\n }\n\n if (nextConfig.basePath) {\n toReturn.env.NEXT_BASE_PATH = nextConfig.basePath\n }\n\n return toReturn\n}\n\nexport default withPayload\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"withPayload.d.ts","sourceRoot":"","sources":["../src/withPayload.js"],"names":[],"mappings":"AAOO,yCANI,OAAO,MAAM,EAAE,UAAU,YAEjC;IAA0B,uBAAuB,GAAzC,OAAO;CAA6F,GAElG,OAAO,MAAM,EAAE,UAAU,CA2KrC"}
1
+ {"version":3,"file":"withPayload.d.ts","sourceRoot":"","sources":["../src/withPayload.js"],"names":[],"mappings":"AAOO,yCANI,OAAO,MAAM,EAAE,UAAU,YAEjC;IAA0B,uBAAuB,GAAzC,OAAO;CAA6F,GAElG,OAAO,MAAM,EAAE,UAAU,CAoIrC"}
@@ -5,22 +5,11 @@
5
5
  *
6
6
  * @returns {import('next').NextConfig}
7
7
  * */export const withPayload = (nextConfig = {}, options = {}) => {
8
- const env = nextConfig?.env || {};
8
+ const env = nextConfig.env || {};
9
9
  if (nextConfig.experimental?.staleTimes?.dynamic) {
10
10
  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.');
11
11
  env.NEXT_PUBLIC_ENABLE_ROUTER_CACHE_REFRESH = 'true';
12
12
  }
13
- if (process.env.PAYLOAD_PATCH_TURBOPACK_WARNINGS !== 'false') {
14
- 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';
15
- const consoleWarn = console.warn;
16
- console.warn = (...args) => {
17
- // Force to disable serverExternalPackages warnings: https://github.com/vercel/next.js/issues/68805
18
- if (typeof args[1] === 'string' && args[1].includes(turbopackWarningText) || typeof args[0] === 'string' && args[0].includes(turbopackWarningText)) {
19
- return;
20
- }
21
- consoleWarn(...args);
22
- };
23
- }
24
13
  const poweredByHeader = {
25
14
  key: 'X-Powered-By',
26
15
  value: 'Next.js, Payload'
@@ -31,16 +20,19 @@
31
20
  const toReturn = {
32
21
  ...nextConfig,
33
22
  env,
23
+ turbopack: {
24
+ ...(nextConfig.turbopack || {})
25
+ },
34
26
  outputFileTracingExcludes: {
35
- ...(nextConfig?.outputFileTracingExcludes || {}),
36
- '**/*': [...(nextConfig?.outputFileTracingExcludes?.['**/*'] || []), 'drizzle-kit', 'drizzle-kit/api']
27
+ ...(nextConfig.outputFileTracingExcludes || {}),
28
+ '**/*': [...(nextConfig.outputFileTracingExcludes?.['**/*'] || []), 'drizzle-kit', 'drizzle-kit/api']
37
29
  },
38
30
  outputFileTracingIncludes: {
39
- ...(nextConfig?.outputFileTracingIncludes || {}),
40
- '**/*': [...(nextConfig?.outputFileTracingIncludes?.['**/*'] || []), '@libsql/client']
31
+ ...(nextConfig.outputFileTracingIncludes || {}),
32
+ '**/*': [...(nextConfig.outputFileTracingIncludes?.['**/*'] || []), '@libsql/client']
41
33
  },
42
34
  // We disable the poweredByHeader here because we add it manually in the headers function below
43
- ...(nextConfig?.poweredByHeader !== false ? {
35
+ ...(nextConfig.poweredByHeader !== false ? {
44
36
  poweredByHeader: false
45
37
  } : {}),
46
38
  headers: async () => {
@@ -56,48 +48,38 @@
56
48
  }, {
57
49
  key: 'Critical-CH',
58
50
  value: 'Sec-CH-Prefers-Color-Scheme'
59
- }, ...(nextConfig?.poweredByHeader !== false ? [poweredByHeader] : [])]
51
+ }, ...(nextConfig.poweredByHeader !== false ? [poweredByHeader] : [])]
60
52
  }];
61
53
  },
62
- serverExternalPackages: [...(nextConfig?.serverExternalPackages || []), 'drizzle-kit', 'drizzle-kit/api', 'pino', 'libsql', 'pino-pretty', 'graphql',
63
- // Do not bundle server-only packages during dev to improve compile speed
64
- ...(process.env.NODE_ENV === 'development' && options.devBundleServerPackages === false ? ['payload', '@payloadcms/db-mongodb', '@payloadcms/db-postgres', '@payloadcms/db-sqlite', '@payloadcms/db-vercel-postgres', '@payloadcms/drizzle', '@payloadcms/email-nodemailer', '@payloadcms/email-resend', '@payloadcms/graphql', '@payloadcms/payload-cloud', '@payloadcms/plugin-redirects'] : [])],
54
+ serverExternalPackages: [...(nextConfig.serverExternalPackages || []),
55
+ // These packages always need to be external, both during dev and production. This is because they install dependencies
56
+ // that will error when trying to bundle them (e.g. drizzle-kit, libsql, esbuild etc.).
57
+ // We cannot externalize those problem-packages directly. We can only externalize packages that are manually installed
58
+ // by the end user. Otherwise, the require('externalPackage') calls generated by the bundler would fail during runtime,
59
+ // as you cannot import dependencies of dependencies in a lot of package managers like pnpm. We'd have to force users
60
+ // to install the dependencies directly.
61
+ // Thus, we externalize the "entry-point" = the package that is installed by the end user, which would be our db adapters.
62
+ //
63
+ //
64
+ // External because it installs mongoose (part of default serverExternalPackages: https://github.com/vercel/next.js/blob/canary/packages/next/src/lib/server-external-packages.json => would throw warning if we don't exclude the entry-point package):
65
+ '@payloadcms/db-mongodb',
66
+ // External because they install dependencies like drizzle, libsql, esbuild etc.:
67
+ '@payloadcms/db-postgres', '@payloadcms/db-sqlite', '@payloadcms/db-vercel-postgres', '@payloadcms/drizzle',
68
+ // External because they install @aws-sdk/client-s3:
69
+ '@payloadcms/payload-cloud',
70
+ // TODO: We need to externalize @payloadcms/storage-s3 as well, once Next.js has the ability to exclude @payloadcms/storage-s3/client from being externalized.
71
+ // Do not bundle additional server-only packages during dev to improve compilation speed
72
+ ...(process.env.NODE_ENV === 'development' && options.devBundleServerPackages === false ? ['payload', '@payloadcms/email-nodemailer', '@payloadcms/email-resend', '@payloadcms/graphql', '@payloadcms/plugin-redirects'] : [])],
65
73
  webpack: (webpackConfig, webpackOptions) => {
66
74
  const incomingWebpackConfig = typeof nextConfig.webpack === 'function' ? nextConfig.webpack(webpackConfig, webpackOptions) : webpackConfig;
67
75
  return {
68
76
  ...incomingWebpackConfig,
69
- externals: [...(incomingWebpackConfig?.externals || []), 'drizzle-kit', 'drizzle-kit/api', 'sharp', 'libsql', 'require-in-the-middle'],
70
- ignoreWarnings: [...(incomingWebpackConfig?.ignoreWarnings || []), {
71
- module: /node_modules\/mongodb\/lib\/utils\.js/
72
- }, {
73
- file: /node_modules\/mongodb\/lib\/utils\.js/
74
- }, {
75
- module: /node_modules\/mongodb\/lib\/bson\.js/
76
- }, {
77
- file: /node_modules\/mongodb\/lib\/bson\.js/
78
- }],
77
+ externals: [...(incomingWebpackConfig?.externals || []), 'require-in-the-middle'],
79
78
  plugins: [...(incomingWebpackConfig?.plugins || []),
80
79
  // Fix cloudflare:sockets error: https://github.com/vercel/next.js/discussions/50177
81
80
  new webpackOptions.webpack.IgnorePlugin({
82
81
  resourceRegExp: /^pg-native$|^cloudflare:sockets$/
83
- })],
84
- resolve: {
85
- ...(incomingWebpackConfig?.resolve || {}),
86
- alias: {
87
- ...(incomingWebpackConfig?.resolve?.alias || {})
88
- },
89
- fallback: {
90
- ...(incomingWebpackConfig?.resolve?.fallback || {}),
91
- '@aws-sdk/credential-providers': false,
92
- '@mongodb-js/zstd': false,
93
- aws4: false,
94
- kerberos: false,
95
- 'mongodb-client-encryption': false,
96
- snappy: false,
97
- 'supports-color': false,
98
- 'yocto-queue': false
99
- }
100
- }
82
+ })]
101
83
  };
102
84
  }
103
85
  };
@@ -1 +1 @@
1
- {"version":3,"file":"withPayload.js","names":["withPayload","nextConfig","options","env","experimental","staleTimes","dynamic","console","warn","NEXT_PUBLIC_ENABLE_ROUTER_CACHE_REFRESH","process","PAYLOAD_PATCH_TURBOPACK_WARNINGS","turbopackWarningText","consoleWarn","args","includes","poweredByHeader","key","value","toReturn","outputFileTracingExcludes","outputFileTracingIncludes","headers","headersFromConfig","source","serverExternalPackages","NODE_ENV","devBundleServerPackages","webpack","webpackConfig","webpackOptions","incomingWebpackConfig","externals","ignoreWarnings","module","file","plugins","IgnorePlugin","resourceRegExp","resolve","alias","fallback","aws4","kerberos","snappy","basePath","NEXT_BASE_PATH"],"sources":["../src/withPayload.js"],"sourcesContent":["/**\n * @param {import('next').NextConfig} nextConfig\n * @param {Object} [options] - Optional configuration options\n * @param {boolean} [options.devBundleServerPackages] - Whether to bundle server packages in development mode. @default true\n *\n * @returns {import('next').NextConfig}\n * */\nexport const withPayload = (nextConfig = {}, options = {}) => {\n const env = nextConfig?.env || {}\n\n if (nextConfig.experimental?.staleTimes?.dynamic) {\n console.warn(\n '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.',\n )\n env.NEXT_PUBLIC_ENABLE_ROUTER_CACHE_REFRESH = 'true'\n }\n\n if (process.env.PAYLOAD_PATCH_TURBOPACK_WARNINGS !== 'false') {\n const turbopackWarningText =\n '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'\n\n const consoleWarn = console.warn\n console.warn = (...args) => {\n // Force to disable serverExternalPackages warnings: https://github.com/vercel/next.js/issues/68805\n if (\n (typeof args[1] === 'string' && args[1].includes(turbopackWarningText)) ||\n (typeof args[0] === 'string' && args[0].includes(turbopackWarningText))\n ) {\n return\n }\n\n consoleWarn(...args)\n }\n }\n\n const poweredByHeader = {\n key: 'X-Powered-By',\n value: 'Next.js, Payload',\n }\n\n /**\n * @type {import('next').NextConfig}\n */\n const toReturn = {\n ...nextConfig,\n env,\n outputFileTracingExcludes: {\n ...(nextConfig?.outputFileTracingExcludes || {}),\n '**/*': [\n ...(nextConfig?.outputFileTracingExcludes?.['**/*'] || []),\n 'drizzle-kit',\n 'drizzle-kit/api',\n ],\n },\n outputFileTracingIncludes: {\n ...(nextConfig?.outputFileTracingIncludes || {}),\n '**/*': [...(nextConfig?.outputFileTracingIncludes?.['**/*'] || []), '@libsql/client'],\n },\n // We disable the poweredByHeader here because we add it manually in the headers function below\n ...(nextConfig?.poweredByHeader !== false ? { poweredByHeader: false } : {}),\n headers: async () => {\n const headersFromConfig = 'headers' in nextConfig ? await nextConfig.headers() : []\n\n return [\n ...(headersFromConfig || []),\n {\n source: '/:path*',\n headers: [\n {\n key: 'Accept-CH',\n value: 'Sec-CH-Prefers-Color-Scheme',\n },\n {\n key: 'Vary',\n value: 'Sec-CH-Prefers-Color-Scheme',\n },\n {\n key: 'Critical-CH',\n value: 'Sec-CH-Prefers-Color-Scheme',\n },\n ...(nextConfig?.poweredByHeader !== false ? [poweredByHeader] : []),\n ],\n },\n ]\n },\n serverExternalPackages: [\n ...(nextConfig?.serverExternalPackages || []),\n 'drizzle-kit',\n 'drizzle-kit/api',\n 'pino',\n 'libsql',\n 'pino-pretty',\n 'graphql',\n // Do not bundle server-only packages during dev to improve compile speed\n ...(process.env.NODE_ENV === 'development' && options.devBundleServerPackages === false\n ? [\n 'payload',\n '@payloadcms/db-mongodb',\n '@payloadcms/db-postgres',\n '@payloadcms/db-sqlite',\n '@payloadcms/db-vercel-postgres',\n '@payloadcms/drizzle',\n '@payloadcms/email-nodemailer',\n '@payloadcms/email-resend',\n '@payloadcms/graphql',\n '@payloadcms/payload-cloud',\n '@payloadcms/plugin-redirects',\n // TODO: Add the following packages, excluding their /client subpath exports, once Next.js supports it\n //'@payloadcms/plugin-cloud-storage',\n //'@payloadcms/plugin-sentry',\n //'@payloadcms/plugin-stripe',\n // @payloadcms/richtext-lexical\n //'@payloadcms/storage-azure',\n //'@payloadcms/storage-gcs',\n //'@payloadcms/storage-s3',\n //'@payloadcms/storage-uploadthing',\n //'@payloadcms/storage-vercel-blob',\n ]\n : []),\n ],\n webpack: (webpackConfig, webpackOptions) => {\n const incomingWebpackConfig =\n typeof nextConfig.webpack === 'function'\n ? nextConfig.webpack(webpackConfig, webpackOptions)\n : webpackConfig\n\n return {\n ...incomingWebpackConfig,\n externals: [\n ...(incomingWebpackConfig?.externals || []),\n 'drizzle-kit',\n 'drizzle-kit/api',\n 'sharp',\n 'libsql',\n 'require-in-the-middle',\n ],\n ignoreWarnings: [\n ...(incomingWebpackConfig?.ignoreWarnings || []),\n { module: /node_modules\\/mongodb\\/lib\\/utils\\.js/ },\n { file: /node_modules\\/mongodb\\/lib\\/utils\\.js/ },\n { module: /node_modules\\/mongodb\\/lib\\/bson\\.js/ },\n { file: /node_modules\\/mongodb\\/lib\\/bson\\.js/ },\n ],\n plugins: [\n ...(incomingWebpackConfig?.plugins || []),\n // Fix cloudflare:sockets error: https://github.com/vercel/next.js/discussions/50177\n new webpackOptions.webpack.IgnorePlugin({\n resourceRegExp: /^pg-native$|^cloudflare:sockets$/,\n }),\n ],\n resolve: {\n ...(incomingWebpackConfig?.resolve || {}),\n alias: {\n ...(incomingWebpackConfig?.resolve?.alias || {}),\n },\n fallback: {\n ...(incomingWebpackConfig?.resolve?.fallback || {}),\n '@aws-sdk/credential-providers': false,\n '@mongodb-js/zstd': false,\n aws4: false,\n kerberos: false,\n 'mongodb-client-encryption': false,\n snappy: false,\n 'supports-color': false,\n 'yocto-queue': false,\n },\n },\n }\n },\n }\n\n if (nextConfig.basePath) {\n toReturn.env.NEXT_BASE_PATH = nextConfig.basePath\n }\n\n return toReturn\n}\n\nexport default withPayload\n"],"mappings":"AAAA;;;;;;KAOA,OAAO,MAAMA,WAAA,GAAcA,CAACC,UAAA,GAAa,CAAC,CAAC,EAAEC,OAAA,GAAU,CAAC,CAAC;EACvD,MAAMC,GAAA,GAAMF,UAAA,EAAYE,GAAA,IAAO,CAAC;EAEhC,IAAIF,UAAA,CAAWG,YAAY,EAAEC,UAAA,EAAYC,OAAA,EAAS;IAChDC,OAAA,CAAQC,IAAI,CACV;IAEFL,GAAA,CAAIM,uCAAuC,GAAG;EAChD;EAEA,IAAIC,OAAA,CAAQP,GAAG,CAACQ,gCAAgC,KAAK,SAAS;IAC5D,MAAMC,oBAAA,GACJ;IAEF,MAAMC,WAAA,GAAcN,OAAA,CAAQC,IAAI;IAChCD,OAAA,CAAQC,IAAI,GAAG,CAAC,GAAGM,IAAA;MACjB;MACA,IACE,OAAQA,IAAI,CAAC,EAAE,KAAK,YAAYA,IAAI,CAAC,EAAE,CAACC,QAAQ,CAACH,oBAAA,KAChD,OAAOE,IAAI,CAAC,EAAE,KAAK,YAAYA,IAAI,CAAC,EAAE,CAACC,QAAQ,CAACH,oBAAA,GACjD;QACA;MACF;MAEAC,WAAA,IAAeC,IAAA;IACjB;EACF;EAEA,MAAME,eAAA,GAAkB;IACtBC,GAAA,EAAK;IACLC,KAAA,EAAO;EACT;EAEA;;;EAGA,MAAMC,QAAA,GAAW;IACf,GAAGlB,UAAU;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CAAW2B,OAAO,KAAK,aAC1B3B,UAAA,CAAW2B,OAAO,CAACC,aAAA,EAAeC,cAAA,IAClCD,aAAA;MAEN,OAAO;QACL,GAAGE,qBAAqB;QACxBC,SAAA,EAAW,C,IACLD,qBAAA,EAAuBC,SAAA,IAAa,EAAE,GAC1C,eACA,mBACA,SACA,UACA,wBACD;QACDC,cAAA,EAAgB,C,IACVF,qBAAA,EAAuBE,cAAA,IAAkB,EAAE,GAC/C;UAAEC,MAAA,EAAQ;QAAwC,GAClD;UAAEC,IAAA,EAAM;QAAwC,GAChD;UAAED,MAAA,EAAQ;QAAuC,GACjD;UAAEC,IAAA,EAAM;QAAuC,EAChD;QACDC,OAAA,EAAS,C,IACHL,qBAAA,EAAuBK,OAAA,IAAW,EAAE;QACxC;QACA,IAAIN,cAAA,CAAeF,OAAO,CAACS,YAAY,CAAC;UACtCC,cAAA,EAAgB;QAClB,GACD;QACDC,OAAA,EAAS;UACP,IAAIR,qBAAA,EAAuBQ,OAAA,IAAW,CAAC,CAAC;UACxCC,KAAA,EAAO;YACL,IAAIT,qBAAA,EAAuBQ,OAAA,EAASC,KAAA,IAAS,CAAC,CAAC;UACjD;UACAC,QAAA,EAAU;YACR,IAAIV,qBAAA,EAAuBQ,OAAA,EAASE,QAAA,IAAY,CAAC,CAAC;YAClD,iCAAiC;YACjC,oBAAoB;YACpBC,IAAA,EAAM;YACNC,QAAA,EAAU;YACV,6BAA6B;YAC7BC,MAAA,EAAQ;YACR,kBAAkB;YAClB,eAAe;UACjB;QACF;MACF;IACF;EACF;EAEA,IAAI3C,UAAA,CAAW4C,QAAQ,EAAE;IACvB1B,QAAA,CAAShB,GAAG,CAAC2C,cAAc,GAAG7C,UAAA,CAAW4C,QAAQ;EACnD;EAEA,OAAO1B,QAAA;AACT;AAEA,eAAenB,WAAA","ignoreList":[]}
1
+ {"version":3,"file":"withPayload.js","names":["withPayload","nextConfig","options","env","experimental","staleTimes","dynamic","console","warn","NEXT_PUBLIC_ENABLE_ROUTER_CACHE_REFRESH","poweredByHeader","key","value","toReturn","turbopack","outputFileTracingExcludes","outputFileTracingIncludes","headers","headersFromConfig","source","serverExternalPackages","process","NODE_ENV","devBundleServerPackages","webpack","webpackConfig","webpackOptions","incomingWebpackConfig","externals","plugins","IgnorePlugin","resourceRegExp","basePath","NEXT_BASE_PATH"],"sources":["../src/withPayload.js"],"sourcesContent":["/**\n * @param {import('next').NextConfig} nextConfig\n * @param {Object} [options] - Optional configuration options\n * @param {boolean} [options.devBundleServerPackages] - Whether to bundle server packages in development mode. @default true\n *\n * @returns {import('next').NextConfig}\n * */\nexport const withPayload = (nextConfig = {}, options = {}) => {\n const env = nextConfig.env || {}\n\n if (nextConfig.experimental?.staleTimes?.dynamic) {\n console.warn(\n '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.',\n )\n env.NEXT_PUBLIC_ENABLE_ROUTER_CACHE_REFRESH = 'true'\n }\n\n const poweredByHeader = {\n key: 'X-Powered-By',\n value: 'Next.js, Payload',\n }\n\n /**\n * @type {import('next').NextConfig}\n */\n const toReturn = {\n ...nextConfig,\n env,\n turbopack: {\n ...(nextConfig.turbopack || {}),\n },\n outputFileTracingExcludes: {\n ...(nextConfig.outputFileTracingExcludes || {}),\n '**/*': [\n ...(nextConfig.outputFileTracingExcludes?.['**/*'] || []),\n 'drizzle-kit',\n 'drizzle-kit/api',\n ],\n },\n outputFileTracingIncludes: {\n ...(nextConfig.outputFileTracingIncludes || {}),\n '**/*': [...(nextConfig.outputFileTracingIncludes?.['**/*'] || []), '@libsql/client'],\n },\n // We disable the poweredByHeader here because we add it manually in the headers function below\n ...(nextConfig.poweredByHeader !== false ? { poweredByHeader: false } : {}),\n headers: async () => {\n const headersFromConfig = 'headers' in nextConfig ? await nextConfig.headers() : []\n\n return [\n ...(headersFromConfig || []),\n {\n source: '/:path*',\n headers: [\n {\n key: 'Accept-CH',\n value: 'Sec-CH-Prefers-Color-Scheme',\n },\n {\n key: 'Vary',\n value: 'Sec-CH-Prefers-Color-Scheme',\n },\n {\n key: 'Critical-CH',\n value: 'Sec-CH-Prefers-Color-Scheme',\n },\n ...(nextConfig.poweredByHeader !== false ? [poweredByHeader] : []),\n ],\n },\n ]\n },\n serverExternalPackages: [\n ...(nextConfig.serverExternalPackages || []),\n // These packages always need to be external, both during dev and production. This is because they install dependencies\n // that will error when trying to bundle them (e.g. drizzle-kit, libsql, esbuild etc.).\n // We cannot externalize those problem-packages directly. We can only externalize packages that are manually installed\n // by the end user. Otherwise, the require('externalPackage') calls generated by the bundler would fail during runtime,\n // as you cannot import dependencies of dependencies in a lot of package managers like pnpm. We'd have to force users\n // to install the dependencies directly.\n // Thus, we externalize the \"entry-point\" = the package that is installed by the end user, which would be our db adapters.\n //\n //\n // External because it installs mongoose (part of default serverExternalPackages: https://github.com/vercel/next.js/blob/canary/packages/next/src/lib/server-external-packages.json => would throw warning if we don't exclude the entry-point package):\n '@payloadcms/db-mongodb',\n // External because they install dependencies like drizzle, libsql, esbuild etc.:\n '@payloadcms/db-postgres',\n '@payloadcms/db-sqlite',\n '@payloadcms/db-vercel-postgres',\n '@payloadcms/drizzle',\n // External because they install @aws-sdk/client-s3:\n '@payloadcms/payload-cloud',\n // TODO: We need to externalize @payloadcms/storage-s3 as well, once Next.js has the ability to exclude @payloadcms/storage-s3/client from being externalized.\n // Do not bundle additional server-only packages during dev to improve compilation speed\n ...(process.env.NODE_ENV === 'development' && options.devBundleServerPackages === false\n ? [\n 'payload',\n '@payloadcms/email-nodemailer',\n '@payloadcms/email-resend',\n '@payloadcms/graphql',\n '@payloadcms/plugin-redirects',\n // TODO: Add the following packages, excluding their /client subpath exports, once Next.js supports it\n //'@payloadcms/plugin-cloud-storage',\n //'@payloadcms/plugin-sentry',\n //'@payloadcms/plugin-stripe',\n // @payloadcms/richtext-lexical\n //'@payloadcms/storage-azure',\n //'@payloadcms/storage-gcs',\n //'@payloadcms/storage-s3',\n //'@payloadcms/storage-uploadthing',\n //'@payloadcms/storage-vercel-blob',\n ]\n : []),\n ],\n webpack: (webpackConfig, webpackOptions) => {\n const incomingWebpackConfig =\n typeof nextConfig.webpack === 'function'\n ? nextConfig.webpack(webpackConfig, webpackOptions)\n : webpackConfig\n\n return {\n ...incomingWebpackConfig,\n externals: [...(incomingWebpackConfig?.externals || []), 'require-in-the-middle'],\n plugins: [\n ...(incomingWebpackConfig?.plugins || []),\n // Fix cloudflare:sockets error: https://github.com/vercel/next.js/discussions/50177\n new webpackOptions.webpack.IgnorePlugin({\n resourceRegExp: /^pg-native$|^cloudflare:sockets$/,\n }),\n ],\n }\n },\n }\n\n if (nextConfig.basePath) {\n toReturn.env.NEXT_BASE_PATH = nextConfig.basePath\n }\n\n return toReturn\n}\n\nexport default withPayload\n"],"mappings":"AAAA;;;;;;KAOA,OAAO,MAAMA,WAAA,GAAcA,CAACC,UAAA,GAAa,CAAC,CAAC,EAAEC,OAAA,GAAU,CAAC,CAAC;EACvD,MAAMC,GAAA,GAAMF,UAAA,CAAWE,GAAG,IAAI,CAAC;EAE/B,IAAIF,UAAA,CAAWG,YAAY,EAAEC,UAAA,EAAYC,OAAA,EAAS;IAChDC,OAAA,CAAQC,IAAI,CACV;IAEFL,GAAA,CAAIM,uCAAuC,GAAG;EAChD;EAEA,MAAMC,eAAA,GAAkB;IACtBC,GAAA,EAAK;IACLC,KAAA,EAAO;EACT;EAEA;;;EAGA,MAAMC,QAAA,GAAW;IACf,GAAGZ,UAAU;IACbE,GAAA;IACAW,SAAA,EAAW;MACT,IAAIb,UAAA,CAAWa,SAAS,IAAI,CAAC,CAAC;IAChC;IACAC,yBAAA,EAA2B;MACzB,IAAId,UAAA,CAAWc,yBAAyB,IAAI,CAAC,CAAC;MAC9C,QAAQ,C,IACFd,UAAA,CAAWc,yBAAyB,GAAG,OAAO,IAAI,EAAE,GACxD,eACA;IAEJ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,EAAuBC,SAAA,IAAa,EAAE,GAAG,wBAAwB;QACjFC,OAAA,EAAS,C,IACHF,qBAAA,EAAuBE,OAAA,IAAW,EAAE;QACxC;QACA,IAAIH,cAAA,CAAeF,OAAO,CAACM,YAAY,CAAC;UACtCC,cAAA,EAAgB;QAClB;MAEJ;IACF;EACF;EAEA,IAAI9B,UAAA,CAAW+B,QAAQ,EAAE;IACvBnB,QAAA,CAASV,GAAG,CAAC8B,cAAc,GAAGhC,UAAA,CAAW+B,QAAQ;EACnD;EAEA,OAAOnB,QAAA;AACT;AAEA,eAAeb,WAAA","ignoreList":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@payloadcms/next",
3
- "version": "3.63.0-canary.4",
3
+ "version": "3.63.0-internal.0bf4b7f",
4
4
  "homepage": "https://payloadcms.com",
5
5
  "repository": {
6
6
  "type": "git",
@@ -97,9 +97,9 @@
97
97
  "qs-esm": "7.0.2",
98
98
  "sass": "1.77.4",
99
99
  "uuid": "10.0.0",
100
- "@payloadcms/graphql": "3.63.0-canary.4",
101
- "@payloadcms/ui": "3.63.0-canary.4",
102
- "@payloadcms/translations": "3.63.0-canary.4"
100
+ "@payloadcms/ui": "3.63.0-internal.0bf4b7f",
101
+ "@payloadcms/graphql": "3.63.0-internal.0bf4b7f",
102
+ "@payloadcms/translations": "3.63.0-internal.0bf4b7f"
103
103
  },
104
104
  "devDependencies": {
105
105
  "@babel/cli": "7.27.2",
@@ -117,12 +117,12 @@
117
117
  "esbuild-sass-plugin": "3.3.1",
118
118
  "swc-plugin-transform-remove-imports": "4.0.4",
119
119
  "@payloadcms/eslint-config": "3.28.0",
120
- "payload": "3.63.0-canary.4"
120
+ "payload": "3.63.0-internal.0bf4b7f"
121
121
  },
122
122
  "peerDependencies": {
123
123
  "graphql": "^16.8.1",
124
124
  "next": "^15.2.3",
125
- "payload": "3.63.0-canary.4"
125
+ "payload": "3.63.0-internal.0bf4b7f"
126
126
  },
127
127
  "engines": {
128
128
  "node": "^18.20.2 || >=20.9.0"