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

failed to resolve custom component after version 0.49.16 #1864

Open
zillionare opened this issue Sep 11, 2024 · 1 comment
Open

failed to resolve custom component after version 0.49.16 #1864

zillionare opened this issue Sep 11, 2024 · 1 comment

Comments

@zillionare
Copy link

zillionare commented Sep 11, 2024

Describe the bug

see #1863 (comment)

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

  • Slidev version: 0.49.29
  • Browser: firefox
  • OS: ubuntu focal

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
Copy link
Author

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.

  • To ensure version consistency, I want these customized components to be in a single place rather than having multiple copies scattered across different themes.

  • I don't want to manage the slides and Slidev files in the same directory. Both the slides and Slidev files will be backed up using GitHub, but I need to put them in different repositories (the slides are private, but the Slidev themes are open source – because Slidev is open source).

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.

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

1 participant