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

React NextJS: external CSS error #27

Open
norama opened this issue Sep 19, 2023 · 4 comments
Open

React NextJS: external CSS error #27

norama opened this issue Sep 19, 2023 · 4 comments

Comments

@norama
Copy link

norama commented Sep 19, 2023

Great lib, but I am struggling to get it function in a React - NextJS project.
It seems that the provided Zoomist distribution is not self-contained, I already tried to add SASS dependency but it only works for storybook. The real app says this:

./node_modules/zoomist/src/scss/index.scss
Global CSS cannot be imported from within node_modules.
Read more: https://nextjs.org/docs/messages/css-npm
Location: node_modules/zoomist/src/index.js

But why it refers to src at all?

There is a solution however:

Instead of

import Zoomist from "zoomist"

write

import Zoomist from "zoomist/dist/zoomist.min.js";
import "zoomist/dist/zoomist.min.css";

But this is not very nice in a React app...

@cotton123236
Copy link
Owner

Hi @norama ,
Thank you for your suggestion! I rebuild Zoomist with TypeScript and already published on NPM just few days ago.
You can checkout branch next. I'll set it to default version after I build the documentation.
After that, I plan to build zoomist/react and zoomist/vue to enrich the developer community. If you have any question or suggestion for Zoomist version 2, please let me know! Thanks!!

@norama
Copy link
Author

norama commented Oct 3, 2023

@cotton123236
Hi, thanks but it is not working for me:

Module not found: Default condition should be last one
  
   import "zoomist/css";
> import Zoomist from "zoomist";

@cotton123236
Copy link
Owner

Hey @norama ,
I fixed this problem at the latest version 2.0.10!
By the way, I switch v2 to default version, so you can install Zoomist from NPM by using npm i zoomist instead of npm i zoomist@next

@norama
Copy link
Author

norama commented Oct 5, 2023

Hi @cotton123236 , thanks a lot for your quick reaction, now it is working OK!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants