vercel / next.js

The React Framework
https://nextjs.org
MIT License
125.95k stars 26.87k forks source link

Turbopack with Next config option "compiler - emotion or styledComponents" do not work #48341

Closed gurkerl83 closed 9 months ago

gurkerl83 commented 1 year ago

Verify canary release

Provide environment information

Operating System:
      Platform: darwin
      Arch: x64
      Version: Darwin Kernel Version 22.3.0: Mon Jan 30 20:42:11 PST 2023; root:xnu-8792.81.3~2/RELEASE_X86_64
    Binaries:
      Node: 18.15.0
      npm: 9.5.0
      Yarn: 1.22.19
      pnpm: N/A
    Relevant packages:
      next: 13.3.1-canary.6
      eslint-config-next: 13.3.0
      react: 18.2.0
      react-dom: 18.2.0

Which area(s) of Next.js are affected? (leave empty if unsure)

Turbopack (--turbo)

Link to the code that reproduces this issue

No reproduction

To Reproduce

Create a new project, turbopack instruction

npx create-next-app --example with-turbopack

Replace next with latest canary in my case 13.3.1-canary.6. Set config option "compiler - emotion or styledComponents", this landed just a few hours before the canary version mentioned was build.

compiler: {
   styledComponents: true,
   emotion: true
}

Describe the Bug

Still receiving that compiler is not supported at all. Guess there is a problem how configuration object "compiler" gets evaluated in https://github.com/vercel/next.js/blob/e97100c5eaff9351ab8b6c83c5341994f22f60e9/packages/next/src/lib/turbopack-warning.ts

Unsupported Next.js configuration option(s) (next.config.js) To use Turbopack, remove the following configuration options:

Expected Behavior

When the compiler options are white-listed they should work similar to the experimental object. In https://github.com/vercel/next.js/blob/e97100c5eaff9351ab8b6c83c5341994f22f60e9/packages/next/src/lib/turbopack-warning.ts extra steps are required to eval the experimental option, for the compiler option I can not see any of those steps in warning.ts

Which browser are you using? (if relevant)

No response

How are you deploying your application? (if relevant)

Executing the dev script in package.json generates the bug

"dev": "next dev --turbo",

yarn dev

MonstraG commented 1 year ago

It seems that since then, the check has been updated and it lets you run it with

compiler: {
    emotion: true
}

Did not work on 13.3.4, works on 13.4.12.

ForsakenHarmony commented 9 months ago

Should be working

github-actions[bot] commented 8 months ago

This closed issue has been automatically locked because it had no new activity for 2 weeks. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.