-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Fabric SSR integration with Next.js #2740
Comments
I had this issue as well. But solved it by creating This is my import React from 'react';
import Document, { Head, Main, NextScript } from 'next/document';
import flush from 'styled-jsx/server';
import { configureLoadStyles } from '@microsoft/load-themed-styles';
import { renderStatic } from 'glamor/server';
import "babel-polyfill";
let _allStyles = '';
configureLoadStyles(styles => {
_allStyles += styles;
});
export default class PSKDocument extends Document {
static getInitialProps({ renderPage }) {
const page = renderPage();
const styles = flush();
const gStyles = renderStatic(() => page.html)
return { ...page, styles, ...gStyles };
}
render() {
return (
<html>
<Head>
<style id="glamor-styles" dangerouslySetInnerHTML={{ __html: this.props.css }} />
<style id="fabric-styles" dangerouslySetInnerHTML={{__html: _allStyles}} />
</Head>
<body>
<Main />
<NextScript />
</body>
</html>
);
}
} |
Thank you! I will try today! |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions to Fabric React! |
This issue has been automatically closed because it has not had recent activity after being marked as stale. If you belive this issue is still a problem or should be reopened, please reopen it! Thank you for your contributions to Fabric React! |
Hi I Use next.js v7.0.2 with costume express server v4.14 , react v 16.6 and fabric v6.93 |
Same issue |
i also have the same issue |
Same issue here. |
Hi All,
I need some guidance for the integration with Next.js.
I checked the Fabric README.md file, and I can make it partially work. However, the result is not very good:
As you can see, if I refresh the page, it takes sometime before the Fabric UI layout getting added. So I feel like there are some issues with my configuration.
My custom express.js looks like:
And the
index.js
file looks like:Should I create a middleware for the
configureLoadStyles
function?Thanks!
The text was updated successfully, but these errors were encountered: