How to correctly import an external stylesheet with import syntax? #2015
-
I am having a difficult problem of importing a library stylesheet in server-side rendering.
I have tried several options, including adding the following line to my webpack-config file:
But all my efforts were to no avail. Could someone help resolve the problem please? |
Beta Was this translation helpful? Give feedback.
Answered by
ocavue
Aug 25, 2023
Replies: 1 comment 6 replies
-
I can take a look to it if you could provide a minimal repo to reproduce this issue. |
Beta Was this translation helpful? Give feedback.
6 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The main issue is that Remirror is a client library that's dependent on browser API like
document
andwindow
. It's not a good idea to render it as some HTML string on the Node.js server.You will need to use some method to skip rendering Remirror on the server, and only load Remirror on the browsers. In React you will need
lazy
andSuspense
for this: https://react.dev/reference/react/lazyFor your example, I can fix it by adding a new
public/EditorLazy.jsx
with the following content: