get-react-spectrum-modules
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
:
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
});