forked from vercel/next.js
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Always transform styled-jsx for rsc and error with client-only condit…
…ion (vercel#43386) Previously we stopped transform css-in-js libraries for RSC server layer because it's not encouraged to use them in server components but client components for saving the bytes of RSC payload. We can detect styled-jsx usage on RSC server layer and error with `client-only` condition, but since it was not transformed properly so it's not erroring properly. In the future, once styled-components and emotion have `client-only` depepdency integrated so we can re-enable the transform for them on server layer ## Bug - [ ] Related issues linked using `fixes #number` - [x] Integration tests added - [ ] Errors have a helpful link attached, see [`contributing.md`](https://github.com/vercel/next.js/blob/canary/contributing.md)
- Loading branch information
1 parent
1191cc3
commit 31e0bfe
Showing
4 changed files
with
16 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 0 additions & 9 deletions
9
test/e2e/app-dir/rsc-errors/app/not-transform/styled-jsx/page.js
This file was deleted.
Oops, something went wrong.
12 changes: 9 additions & 3 deletions
12
test/e2e/app-dir/rsc-errors/app/server-with-errors/styled-jsx/page.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,11 @@ | ||
import JSXStyle from 'styled-jsx/style' | ||
|
||
export default function Page() { | ||
return <JSXStyle>{`p{color:red}`}</JSXStyle> | ||
return ( | ||
<div> | ||
<style jsx>{` | ||
p { | ||
color: red; | ||
} | ||
`}</style> | ||
</div> | ||
) | ||
} |