You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: support turbopack build on Next.js canaries (#14845)
Fixes#14786
In the latest Next.js 16 canaries, the Next.js team introduced support
for externalizing transitive dependencies, which unlocks compatibility
with Turbopack Build.
This PR updates our withPayload.js wrapper to take advantage of that
capability. It adds a version check that automatically enables Turbopack
Build support when the project is using Next.js ≥ `16.1.0-canary.3`.
// 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.
20
-
// We can remove this once Next.js implements https://github.com/vercel/next.js/discussions/76991
21
-
constturbopackWarningText=
22
-
'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'
23
-
24
-
// TODO 4.0: Remove this once we drop support for Next.js 15.2.x
25
-
constturbopackConfigWarningText="Unrecognized key(s) in object: 'turbopack'"
26
-
27
-
constconsoleWarn=console.warn
28
-
console.warn=(...args)=>{
29
-
// Force to disable serverExternalPackages warnings: https://github.com/vercel/next.js/issues/68805
'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.',
// serverExternalPackages = webpack.externals, but with turbopack support and an additional check
120
-
// for whether the package is resolvable from the project root
121
-
...(nextConfig.serverExternalPackages||[]),
122
-
// 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.
123
-
//
124
84
// WHY: without externalizing graphql, a graphql version error will be thrown
125
85
// during runtime ("Ensure that there is only one instance of \"graphql\" in the node_modules\ndirectory.")
126
86
'graphql',
127
-
// External, because it installs import-in-the-middle and require-in-the-middle - both in the default serverExternalPackages list.
0 commit comments