Khan / Khan/aphrodite

SSR Component Library

Open
#290 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
5.3k
Forks
187
PR merge metrics
No merged PRs in 30d

Description

We have a component library with components styled using aphrodite.

When importing this into a server-side rendered project the components we get the following error:

```

Error: Cannot automatically buffer without a document

```

**npm packaged component**

```
import React from "react";
import { StyleSheet, css } from "aphrodite";

const Card = () => {
const baseStyles = StyleSheet.create({
container: {
color: "blue"
}
});

return (

Card

);
}

export default Card;
```

**SSR Rendered App**

```
import React from 'react';
import { Card } from 'component library here';

export const App = () =>



;

export default App;
```

If I use an aphrodite styled component within the application it runs with no issue.

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the error using the npm-packaged Card component and the SSR-rendered App example in the issue, then compare it with an Aphrodite component defined inside the application. Trace why the packaged component cannot render without a document; done means the library component renders in the server-side environment without the buffering error.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend, web-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.