next.js icon indicating copy to clipboard operation
next.js copied to clipboard

Emotion SWC plugin improperly handled escape sequences

Open tills13 opened this issue 3 years ago • 5 comments

Verify canary release

  • [X] I verified that the issue exists in the latest Next.js canary release

Provide environment information

Operating System:
  Platform: linux
  Arch: x64
  Version: #1 SMP Wed Feb 19 06:37:35 UTC 2020
Binaries:
  Node: 16.15.0
  npm: 8.5.5
  Yarn: N/A
  pnpm: N/A
Relevant packages:
  next: 12.2.1-canary.2
  eslint-config-next: N/A
  react: 18.2.0
  react-dom: 18.2.0

What browser are you using? (if relevant)

N/A

How are you deploying your application? (if relevant)

N/A

Describe the Bug

With Emotion SWC enabled: the text of the escape sequence is rendered Without Emotion SWC enabled: the symbol is rendered properly

To toggle between the two, apply to next.config.js and restart the app.

+    emotion: false,
-    emotion: {
-      autoLabel: "never",
-      sourceMap: true,
-    },

Expected Behavior

In both situations, the symbol is properly rendered.

Note that the escape sequence \203A works as expected in both scenarios.

Link to reproduction

https://github.com/tills13/nextjs-emotion-escape

To Reproduce

Run

$ npm ci
$ npm run dev

Navigate to whatever URL nextjs outputs. You should see the escape sequence rendered as the text of the escape rather than as a symbol.

tills13 avatar Jul 04 '22 15:07 tills13

Please verify your issue reproduces with next@canary. The canary version of Next.js ships daily and includes all features and fixes that have not been released to the stable version yet. Think of canary as a public beta. Some issues may already be fixed in the canary version, so please verify that your issue reproduces by running npm install next@canary. If the issue does not reproduce with the canary version, then it has already been fixed and this issue can be closed.

github-actions[bot] avatar Jul 04 '22 15:07 github-actions[bot]

See https://github.com/emotion-js/emotion/issues/2802 for more discussion

tills13 avatar Jul 04 '22 15:07 tills13

The example repo uses the released version of Next but as noted in the next info output above I've verified it against next@canary

tills13 avatar Jul 04 '22 15:07 tills13

x-ref https://github.com/swc-project/swc/issues/5072 /cc @kdy1

Brooooooklyn avatar Jul 05 '22 06:07 Brooooooklyn

Can you try a new version?

kdy1 avatar Sep 27 '22 03:09 kdy1

This should be fixed on canary

kdy1 avatar Jan 30 '24 07:01 kdy1

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.

github-actions[bot] avatar Feb 13 '24 12:02 github-actions[bot]