Skip to content

Commit d516424

Browse files
reidbarberdannify
andauthored
update SSR docs to support Next 11+ (#2215)
Co-authored-by: Danni <[email protected]>
1 parent ac899a0 commit d516424

File tree

1 file changed

+45
-12
lines changed
  • packages/dev/docs/pages/react-spectrum

1 file changed

+45
-12
lines changed

packages/dev/docs/pages/react-spectrum/ssr.mdx

Lines changed: 45 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -52,30 +52,63 @@ Finally, when using server side rendering, the `locale` prop should be set expli
5252
5353
[Next.js](https://nextjs.org) is a framework for building websites and web applications with React. It supports both server side rendering as well as static rendering. In addition to using an `SSRProvider`, a small amount of configuration is required to get React Spectrum’s CSS working with Next.js.
5454
55-
First, you’ll need to install a couple Next.js plugins:
55+
First, you’ll need to install an additional Next.js plugin:
5656
5757
```
58-
yarn add next-compose-plugins @zeit/next-css next-transpile-modules
58+
yarn add next-transpile-modules
5959
```
6060
61-
With these installed, add the following to your `next.config.js` file. This will ensure that React Spectrum’s CSS is loaded properly by Next.js.
61+
With this installed, add the following to your `next.config.js` file. This will ensure that React Spectrum’s CSS is loaded properly by Next.js. Note that packages may need to be removed or added to the config below if using an older or newer version of React Spectrum.
6262
6363
```tsx
64-
const withPlugins = require('next-compose-plugins');
65-
const withCSS = require('@zeit/next-css');
66-
const withTM = require('next-transpile-modules')([
67-
'@adobe/react-spectrum',
68-
'@spectrum-icons/.*',
69-
'@react-spectrum/.*'
64+
const withTM = require("next-transpile-modules")([
65+
"@adobe/react-spectrum",
66+
"@react-spectrum/actiongroup",
67+
"@react-spectrum/breadcrumbs",
68+
"@react-spectrum/button",
69+
"@react-spectrum/buttongroup",
70+
"@react-spectrum/checkbox",
71+
"@react-spectrum/combobox",
72+
"@react-spectrum/dialog",
73+
"@react-spectrum/divider",
74+
"@react-spectrum/form",
75+
"@react-spectrum/icon",
76+
"@react-spectrum/illustratedmessage",
77+
"@react-spectrum/image",
78+
"@react-spectrum/label",
79+
"@react-spectrum/layout",
80+
"@react-spectrum/link",
81+
"@react-spectrum/listbox",
82+
"@react-spectrum/menu",
83+
"@react-spectrum/meter",
84+
"@react-spectrum/numberfield",
85+
"@react-spectrum/overlays",
86+
"@react-spectrum/picker",
87+
"@react-spectrum/progress",
88+
"@react-spectrum/provider",
89+
"@react-spectrum/radio",
90+
"@react-spectrum/slider",
91+
"@react-spectrum/searchfield",
92+
"@react-spectrum/statuslight",
93+
"@react-spectrum/switch",
94+
"@react-spectrum/tabs",
95+
"@react-spectrum/text",
96+
"@react-spectrum/textfield",
97+
"@react-spectrum/theme-dark",
98+
"@react-spectrum/theme-default",
99+
"@react-spectrum/theme-light",
100+
"@react-spectrum/tooltip",
101+
"@react-spectrum/view",
102+
"@react-spectrum/well",
103+
"@spectrum-icons/ui",
104+
"@spectrum-icons/workflow"
70105
]);
71106
72-
module.exports = withPlugins([withCSS, withTM], {
107+
module.exports = withTM({
73108
// Your Next.js configuration
74109
});
75110
```
76111

77-
For an example of a working Next.js app using React Spectrum, see [this repo](https://github.com/devongovett/rsp-next).
78-
79112
## Gatsby
80113

81114
[Gatsby](https://www.gatsbyjs.com) is a static site generator built with React. Gatsby works out of the box with React Spectrum without any additional configuration. For an example of a working Gatsby site using React Spectrum, see [this repo](https://github.com/devongovett/rsp-gatsby).

0 commit comments

Comments
 (0)