slidevjs / slidev

Presentation Slides for Developers
https://sli.dev
MIT License
31.94k stars 1.26k forks source link

[unocss] Entry module not found. Did you add `import 'uno.css'` in your main entry? #1719

Closed zillionare closed 6 days ago

zillionare commented 6 days ago

Describe the bug

I'm developing a slidev theme: https://github.com/zillionare/slidev-theme-rich Everything works ok when checked by npm run dev. However, if I try to build it, unocss warning happens:

[plugin:unocss:global:build:bundle] [plugin unocss:global:build:bundle] [unocss] Entry module not found. Did you add `import 'uno.css'` in your main entry? (x2)

And the final result is broken.

图片

Minimal reproduction

Steps to reproduce the behavior:

  1. checkout https://github.com/zillionare/slidev-theme-rich
  2. run npm run dev, check the output, everything is ok.
  3. run npm run build, the above warning appears and the webpage is broken.

Environment


More screenshots:

the right one(dev mode):

图片

the bad one(build mode)

图片

It's my first theme, so maybe I'm asking dumb questions, thanks if you can help.

KermanX commented 6 days ago

I think removing the UnoCSS plugin in your vite.config.ts can solve this. Slidev has imported that plugin internally.

image

zillionare commented 6 days ago

Verified and many thanks!