Skip to main content

Importing in your project

GitHub repository

Inside a Node.js-based project

You can add the React component to your Node.js-based project (e.g. using Next.js or Vite) with:

npm install @frameright/react-image-display-control

No matter whether your code is intended to run in the browser, during server-side rendering or at build time for building static pages, you can import the React component anywhere with:

import '@frameright/react-image-display-control';

Inside a Next.js project

As a workaround for this issue, you need to set config.resolve.fallback = { fs: false }; in your next.config.js in order to be able to import the React component. Your file should look like this:

module.exports = {
webpack: (config) => {
config.resolve.fallback = { fs: false };
return config;

Create it if it doesn't exist yet in your project.

See also this StackOverflow question: Module not found: Can't resolve 'fs' in Next.js application