Skip to content

Global CSS cannot be imported from within node_modules. (Solved) #186

Description

@a90100

For developers who faced the same issue as me:

Image

If you see this error message and you're using Next.js v13, please follow these steps to solve the problem:

Step 1: Install the package

npm i @uiw/react-textarea-code-editor

Step 2: Import the CSS

Add import '@uiw/react-textarea-code-editor/dist.css'; to your _app.page.jsx (or tsx)

Step3. Dynamically import the CodeEditor component

import dynamic from 'next/dynamic';

const CodeEditor = dynamic(() => import('@uiw/react-textarea-code-editor/cjs').then((mod) => mod.default), {
  ssr: false,
});

I hope these steps help you solve the issue!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions