payload icon indicating copy to clipboard operation
payload copied to clipboard

⚠Webpack is configured while Turbopack is not, which may cause problems.

Open drago1520 opened this issue 7 months ago • 2 comments

Describe the Bug

I cannot understand whether Payload uses a turbopack or not. When I try to enable turbopack by adding --turbopack to the dev script, I am greeted by:

⚠ Webpack is configured while Turbopack is not, which may cause problems. ⚠ See instructions if you need to configure Turbopack: https://nextjs.org/docs/app/api-reference/next-config-js/turbo

Link to the code that reproduces this issue

https://gitlab.com/drago1520/bbh2.git

Reproduction Steps

  1. npx create-payload-app
  2. add --turbopack to dev script.
  3. pnpm dev Now you will get the error: ⚠ Webpack is configured while Turbopack is not, which may cause problems. ⚠ See instructions if you need to configure Turbopack: https://nextjs.org/docs/app/api-reference/next-config-js/turbo

Which area(s) are affected? (Select all that apply)

area: core

Environment Info

Binaries:
  Node: 23.11.0
  npm: N/A
  Yarn: N/A
  pnpm: 10.10.0
Relevant Packages:
  payload: 3.39.1
  next: 15.3.0
  @payloadcms/db-postgres: 3.39.1
  @payloadcms/email-nodemailer: 3.39.1
  @payloadcms/graphql: 3.39.1
  @payloadcms/next/utilities: 3.39.1
  @payloadcms/payload-cloud: 3.39.1
  @payloadcms/richtext-lexical: 3.39.1
  @payloadcms/translations: 3.39.1
  @payloadcms/ui/shared: 3.39.1
  react: 19.1.0
  react-dom: 19.1.0
Operating System:
  Platform: win32
  Arch: x64
  Version: Windows 10 Pro
  Available memory (MB): 32570
  Available CPU cores: 8

drago1520 avatar May 25 '25 14:05 drago1520

Please add a reproduction in order for us to be able to investigate.

Depending on the quality of reproduction steps, this issue may be closed if no reproduction is provided.

Why was this issue marked with the invalid-reproduction label?

To be able to investigate, we need access to a reproduction to identify what triggered the issue. We prefer a link to a public GitHub repository created with create-payload-app@latest -t blank or a forked/branched version of this repository with tests added (more info in the reproduction-guide).

To make sure the issue is resolved as quickly as possible, please make sure that the reproduction is as minimal as possible. This means that you should remove unnecessary code, files, and dependencies that do not contribute to the issue. Ensure your reproduction does not depend on secrets, 3rd party registries, private dependencies, or any other data that cannot be made public. Avoid a reproduction including a whole monorepo (unless relevant to the issue). The easier it is to reproduce the issue, the quicker we can help.

Please test your reproduction against the latest version of Payload to make sure your issue has not already been fixed.

I added a link, why was it still marked?

Ensure the link is pointing to a codebase that is accessible (e.g. not a private repository). "example.com", "n/a", "will add later", etc. are not acceptable links -- we need to see a public codebase. See the above section for accepted links.

Useful Resources

github-actions[bot] avatar May 25 '25 14:05 github-actions[bot]

same problem

anguiao avatar Jun 01 '25 14:06 anguiao

FYI, this is a warning that can be safely ignored. Nonetheless we'll investigate how to get rid of this warning

AlessioGr avatar Jun 02 '25 21:06 AlessioGr

I got rid of that by adding this to my next.config.ts file - I'm using svg so your rules may be different

  turbopack: {
    resolveExtensions: ['.mdx', '.tsx', '.ts', '.jsx', '.js', '.mjs', '.json'],
    rules: {
      '*.svg': {
        loaders: ['@svgr/webpack'],
        as: '*.js',
      },
    },
  },

HoboElla avatar Jun 04 '25 08:06 HoboElla

FYI, this is a warning that can be safely ignored. Nonetheless we'll investigate how to get rid of this warning

It would be good if you add a section about turbopack in the documentation. Also officially have this statement that it can be ignored

Thanks

bayraak avatar Jun 06 '25 11:06 bayraak

FYI, this is a warning that can be safely ignored. Nonetheless we'll investigate how to get rid of this warning

It would be good if you add a section about turbopack in the documentation. Also officially have this statement that it can be ignored

Thanks

You need to read the Next.js documentation for info about Turbopack

HoboElla avatar Jun 09 '25 06:06 HoboElla

From my 2-week experience, it has not caused any problems. I am using it in my Payload Postgres starter, which has less bloat than the website template, and most importantly, it works (ex.: Live editing)

drago1520 avatar Jun 10 '25 17:06 drago1520

I got rid of that by adding this to my next.config.ts file - I'm using svg so your rules may be different

  turbopack: {
    resolveExtensions: ['.mdx', '.tsx', '.ts', '.jsx', '.js', '.mjs', '.json'],
    rules: {
      '*.svg': {
        loaders: ['@svgr/webpack'],
        as: '*.js',
      },
    },
  },

updated to latest payload and appended --turbo to dev and dev:prod and updated config as here. Now everything works without that annoying warning. Thanks @HoboElla

sharathsDev avatar Jun 11 '25 05:06 sharathsDev

I found that if you have an empty turbopack object in your next.config file, then you get this warning.

Adding a resolveExtensions key and value to the turbopack object fixed the warning for me.

// next.config.js

const nextConfig: NextConfig = {
    turbopack: {}, // <-- causes warning to appear
};
// next.config.js

const nextConfig: NextConfig = {
    turbopack: {
        resolveExtensions: ['.foo', '.bar'], <-- warning no longer appears
    },
};

benjeater avatar Oct 22 '25 07:10 benjeater