-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Critical styles missing during server render with Next.js #1079
Comments
I am using RNW here in Este and it seems it works. Maybe it can help. |
@steida thanks for the tip. Unfortunately, you are utilizing the CommonJS version of RNW’s modules, which I am already able to get working. My primary goal is to have server styles work when I compile RNW’s ES module exports with Babel. |
Have you looked into why? What's different about the bundle? |
@necolas I have done a fair amount of debugging, but have been unable to identify what is going wrong. The only piece I’ve noticed and don’t quite understand is that, on the server, If you don’t have any specific thoughts or guidance, I’ll try to dive deeper and see if I can find something. I understand you can’t debug every integration/application. Thank you for your hard work on RNW. |
Yeah the server only needs rules pushed into the array. My first thought is that webpack is dropping some code. If the issue didn't exist for cjs understanding the difference between the 2 module formats is probably where I'd start |
@necolas below is a log of a single page load run. I'm not sure what is occurring here. Context
ES Modules Log
CJS Modules Log
As you can see, the top-level Questions
I'll try to keep digging, but wanted to pose these questions in case something stood out to you. My second question is the primary question blocking me from digging deeper. Thanks again for the help. |
@necolas below is the dependency tree arriving at When using ES modules, a breakpoint in Do you know why the
|
Nope. Can't tell if this is a webpack or Next.js thing either |
Alright. I agree this is likely not an issue with RNW. I'll close this issue and open an issue in the Next.js community. Thank you for guidance. |
Oh I don't know, it might be something to do with RNW. I don't mind leaving this open until we know what the issue is |
I was able to resolve this issue by upgrading to TL;DR – webpack doesn't use |
The problem
When server rendering a Next.js application, the "critical" styles for the given page are missing. They apply correctly, however, in the client.
How to reproduce
Simplified test case: https://github.com/HealthTeacher/nextjs-rnw
Steps to reproduce:
yarn install
yarn start
Expected behavior
The "critical" styles for the page are rendered by the server.
Environment (include versions). Did this work in previous versions?
Notes:
react-native-web
issue, but I am failing to determine how to properly integrate Next.js as the app renderer.react-native-web
changing the default exports to ES6 modules in0.7.0
.commonjs: true
forbabel-plugin-react-native-web
rather than compilingreact-native-web
with webpack fixes the missing styles (i.e. revert this change).The text was updated successfully, but these errors were encountered: