Skip to content
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

Styles are not loaded for SSR #237

Open
DarkGenius opened this issue May 15, 2024 · 7 comments
Open

Styles are not loaded for SSR #237

DarkGenius opened this issue May 15, 2024 · 7 comments

Comments

@DarkGenius
Copy link
Collaborator

No description provided.

@longpoll
Copy link

+1

1 similar comment
@vladislav805
Copy link

+1

@Fatal1stZ
Copy link

@max-portador
Copy link

max-portador commented Sep 26, 2024

It`s Next.js problem - https://nextjs.org/docs/messages/css-npm

I found a solution for Next.js.

If you are using Next.js 13.1 or higher, you should define the transpilePackages option in next.config.js:

/** @type {import('next').NextConfig} */
const nextConfig = {
  transpilePackages: ['@gravity-ui/navigation', '@gravity-ui/uikit'],
};

module.exports = nextConfig;

Example:
https://stackblitz.com/edit/stackblitz-starters-izlcht?file=next.config.js,app%2Flayout.tsx

Before Next.js 13 you can try next-transpile-modules

@Fatal1stZ
Copy link

@max-portador It's still "blinking" in your example, styles are properly loaded on the client side only.

@vladislav805
Copy link

vladislav805 commented Sep 27, 2024

It`s Next.js problem

I don't use Next.js at all and the problem is the same. Moreover, the problem is that when this package building, the styles are bundled to JS, not to separate CSS files.

@GoncharovV
Copy link

+1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants