Skip to content
Discussion options

You must be logged in to vote

I think I solved the problem.
Update results, may be helpful to others.
(🙏 can anyone help me close this discussion?)

styled-jsx cannot collect styles from node_modules, even if these style components are generated with styled-jsx.

As a solution, you can export the flush of styled-jsx/server manually in the library, only in this way, we cat get styleSheetRegistry instance.

Example:

In your component library:

import flush from 'styled-jsx/server'

const BaseCssComponent = () => {
  return (
    <div>
      <style global jsx>{`
        html {
          font-size: 30px;
        }
      `}</style>
    </div>
  )
}

BaseCssComponent.flush = flush
export default BaseCssComponent
// or export { …

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Answer selected by unix
Comment options

You must be logged in to vote
2 replies
@unix
Comment options

@rafaelalmeidatk
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
2 participants