Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/msabramo/get-react-spectrum-modules
Get an array of all React Spectrum modules, useful for integrating with Next.js
https://github.com/msabramo/get-react-spectrum-modules
Last synced: 15 days ago
JSON representation
Get an array of all React Spectrum modules, useful for integrating with Next.js
- Host: GitHub
- URL: https://github.com/msabramo/get-react-spectrum-modules
- Owner: msabramo
- Created: 2021-12-20T08:57:24.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2022-06-10T03:21:18.000Z (over 2 years ago)
- Last Synced: 2024-12-03T21:58:13.899Z (28 days ago)
- Language: JavaScript
- Size: 359 KB
- Stars: 1
- Watchers: 3
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# get-react-spectrum-modules
[![Test](https://github.com/msabramo/get-react-spectrum-modules/actions/workflows/test.yaml/badge.svg)](https://github.com/msabramo/get-react-spectrum-modules/actions/workflows/test.yaml)
This package exports a function that returns an array of all [React Spectrum][]
modules that it finds in the `node_modules` directory.One use case for this function is it can be used to wrap the [Next.js][]
configuration in `next.config.js` so that React Spectrum works in [Next.js][]
without any errors.You can do something like this in your `next.config.js`:
```js
const nextTranspileModules = require("next-transpile-modules");
const getReactSpectrumModules = require("get-react-spectrum-modules");// This wraps the Next.js configuration to do some transpilations so that React
// Spectrum works in Next.js without any errors.
//
// Inspired by https://react-spectrum.adobe.com/react-spectrum/ssr.html#nextjs
//
const withTM = nextTranspileModules(getReactSpectrumModules());module.exports = withTM({
// Your Next.js configuration
});
```[react spectrum]: https://react-spectrum.adobe.com/react-spectrum/
[next.js]: https://nextjs.org/