react-monaco-editor: Next.js: Global CSS cannot be imported from within node_modules

Describe the bug When adding it into an existing next.js project using yarn add react-monaco-editor, it results into an error as following:

error - ./node_modules/monaco-editor/esm/vs/base/browser/ui/actionbar/actionbar.css
Global CSS cannot be imported from within node_modules.
Read more: https://err.sh/next.js/css-npm
Location: node_modules/monaco-editor/esm/vs/base/browser/ui/actionbar/actionbar.js

To Reproduce Create a nextjs app using create-next-app and install the package. Then use the component from the package.

Expected behavior It shouldn’t give any error

Environment (please complete the following information):

  • OS: Arch Linux x86_64
  • Browser: Chromium
  • Bundler: Next.js

Repo: https://github.com/mdgaziur/CompCoder Go to the src/frontend folder

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 15 (3 by maintainers)

Most upvoted comments

Ok, was able to make another package work. Thanks for spending time on this issue. I’m closing it :^)

what package worked for you, if I may ask?

+1. Need a fix for this as well.

Can’t remember after such a long time. But probably this: https://www.npmjs.com/package/@monaco-editor/react