slidevjs / slidev

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

failed to resolve custom component after version 0.49.16 #1864

Open zillionare opened 2 months ago

zillionare commented 2 months ago

Describe the bug

see https://github.com/slidevjs/slidev/discussions/1863#discussioncomment-10613408

Minimal reproduction

attached please find a reproducible example.

after decompressed, cd to root/project, then run

./start

this will install node_module and launch the site. You'll find a workable version, like this:

图片

then stop it, perform the following actions:

  1. cd to root/project, remove .vite
  2. goto root/slidev_themes, edit package.json, change version to 0.49.29
  3. remove node_modules
  4. then start slidev again.

you'll find cannot resolve custom component in develop pane. custom-component-resolve-issue.tar.gz

before compressing, I've removed .git and styles/fonts folder, this should have no side effect.

Environment

If you are using Slidev globally (i.e. npx slidev or npm i -g slidev), please try to reproduce the issue in a local project (i.e. npm create slidev@latest).

zillionare commented 1 month ago

confirmed run the slide without npx lead to same:

npm run dev -- ~/workspace/issue/project/slides.md -t ~/workspace/issue/slidev_themes/themes/landscape-jade/

image

Success Scenario

if I move slidev_themes/components, package.json and project/slides.md,..etc into themes/landscape-jade, it will all work (but without specify theme. If I did, it will complain that route is not found)

Why should I use the folder structure in the issue?

I am an online course teacher. In different courses and scenarios (exercise, promotion, main course, etc), I need to use different themes, but I will always use the same components.

workaround

link project to theme/slides.md
ln -s ~/workspace/issue/project/slides.md ./slides.md
ln -s ~/workspace/issue/project/pages ./pages

And keep components still copied into landscape_jade, this works.

link components
ln -s ~/workspace/issue/slidev_themes/components ./components

this will work too.

Therefore, before running a specific slide, I just need to create some symbolic links. The only inconvenience is that I have about 10 themes (most of which are meaningless experiments), and now these themes will unnecessarily install node_modules 10 times. However, this is not a major issue.

By the way, Slidev is an excellent project, and I really love it. I have even tried writing themes for it and released them. Later, I realized that I was doing some things that Slidev had already done, and I wasn’t doing them as well. Additionally, I used syntax that conflicts with Slidev. It seems that I am not yet ready to release my own themes. My themes might not help others and could instead waste their time.