Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Global CSS cannot be imported from within node_modules. #545

Closed
MikkelsWorld opened this issue Feb 9, 2021 · 4 comments
Closed

Global CSS cannot be imported from within node_modules. #545

MikkelsWorld opened this issue Feb 9, 2021 · 4 comments
Labels
👀 no/external This makes more sense somewhere else

Comments

@MikkelsWorld
Copy link

MikkelsWorld commented Feb 9, 2021

Subject of the issue

./node_modules/@uiw/react-markdown-preview/lib/esm/styles/markdowncolor.css
Global CSS cannot be imported from within node_modules.
Read more: https://err.sh/next.js/css-npm
Location: node_modules/@uiw/react-markdown-preview/lib/esm/index.js)

Your environment

  • OS: Windows 10 running WSL Debian 10
  • Packages:
  • "@fortawesome/fontawesome-svg-core": "^1.2.32", "@fortawesome/free-solid-svg-icons": "^5.15.1", "@fortawesome/react-fontawesome": "^0.1.14", "@tailwindcss/typography": "^0.3.1", "@testing-library/jest-dom": "^4.2.4", "@testing-library/react": "^9.5.0", "@testing-library/user-event": "^7.2.1", "@uiw/react-md-editor": "^2.0.3", "autoprefixer": "^10.0.4", "axios": "^0.21.1", "cssnano": "^4.1.10", "moment": "^2.29.1", "next": "latest", "postcss": "^8.1.10", "react": "^17.0.1", "react-dom": "^17.0.1", "react-markdown": "^5.0.3", "react-moment": "^1.1.1", "tailwindcss": "^2.0.2", "tailwindcss-markdown": "^1.0.1"
  • Env: NPM Version 6.14.9

Steps to reproduce

Really just need to install it on NextJS, its a policy they enforce.

Expected behavior

It should be able to build properly, but because of the import of global CSS it does not.

Actual behavior

info - Creating an optimized production build
Failed to compile.

./node_modules/@uiw/react-markdown-preview/lib/esm/styles/markdowncolor.css
Global CSS cannot be imported from within node_modules.
Read more: https://err.sh/next.js/css-npm
Location: node_modules/@uiw/react-markdown-preview/lib/esm/index.js

More info vercel/next.js#19936

@MikkelsWorld MikkelsWorld added 🐛 type/bug This is a problem 🙉 open/needs-info This needs some more info labels Feb 9, 2021
@ChristianMurphy
Copy link
Member

@mikkelbiz two things:

  1. react-markdown doesn't add any CSS, any CSS would be added by a downstream package or an implementer.
  2. from your stacktrace, the issue is coming from node_modules/@uiw/react-markdown-preview/lib/esm/index.js issues with this package can be logged to https://github.com/uiwjs/react-markdown-preview/issues

@ChristianMurphy ChristianMurphy added 👀 no/external This makes more sense somewhere else and removed 🐛 type/bug This is a problem 🙉 open/needs-info This needs some more info labels Feb 9, 2021
@ChristianMurphy
Copy link
Member

Also you may want to checkout uiwjs/react-markdown-preview#38 which discusses Next support and includes an example.

@jaywcjlove
Copy link

@jaywcjlove
Copy link

uiwjs/react-md-editor#52 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
👀 no/external This makes more sense somewhere else
Development

No branches or pull requests

3 participants