Problem on first launch when using components in `global-top.vue`
Describe the bug
When I start the server first the first time after a fresh npm i I have a blank page.
Here is a repository for reproducing the problem: https://github.com/tonai/slidev-reproduction
I use a vue component in global-top.vue that is imported in VueJS with the setup/main.ts.
- Without using a component in
global-top.vue, the problem is not present anymore - If you kill and start the server again, the problem is not present anymore
- If you refresh the page, the problem is not present anymore
Sometimes (but not always), I have a warning in the log, when starting the server for the first time:
●■▲
Slidev v0.28.2
theme @slidev/theme-default
entry /home/tocab/Projects/Test/slidev/slides.md
slide show > http://localhost:3030/
presenter mode > http://localhost:3030/presenter
remote control > pass --remote to enable
shortcuts > restart | open | edit
Sourcemap for "/@slidev/slides/3.md" points to missing source files
Sourcemap for "/@slidev/slides/6.md" points to missing source files
Sourcemap for "/@slidev/slides/7.md" points to missing source files
Sourcemap for "/@slidev/slides/8.md" points to missing source files
Sourcemap for "/@slidev/slides/10.md" points to missing source files
Sourcemap for "/@slidev/slides/5.md" points to missing source files
Sourcemap for "/@slidev/slides/9.md" points to missing source files
Sourcemap for "/@slidev/slides/2.md" points to missing source files
Sourcemap for "/@slidev/slides/4.md" points to missing source files
Sourcemap for "/@slidev/slides/1.md" points to missing source files
16:01:11 [vite] Failed to load source map for /node_modules/.vite/nanoid.js?v=88a684eb.
Also sometimes the warning is different: [vite] Failed to load source map for /node_modules/.vite/vite-plugin-vue-server-ref_client.js?v=40663220.
The problem is also present if you export your slides to PDF with npm run export.
In that case the first page will be blank.
But this is really problematic because I want to generate the PDF with a CI...
To Reproduce Steps to reproduce the behavior:
-
git clone [email protected]:tonai/slidev-reproduction.git -
cd slidev-reproduction -
npm i -
npm run dev - They you should have an empty page opening in the browser
If you want to reproduce again:
-
rm -rf node_modules -
npm i -
npm run dev
Desktop (please complete the following information):
- OS: ubuntu 20.04.3 LTS (Focal Fossa)
- Browser: chrome 96.0.4664.110
- Slidev version: 0.28.2
- node: 16.13.1
- npm: 8.1.2
A quick fix this would be to run the pdf export 2 times, but that's not really great...
Another way of fixing would be to have some kind of prebuild command we can run before running the export or running the dev server.
Or maybe we can have a way of choosing if the component we want to display in global-top.vue should be exported in the PDF or if it should only be available for the web version (here it's the case).
Note: the bug is not present on the PWA created with the npm run build command
If I create the components directory and put the component I want to use inside it and then remove the ./setup/main.ts file, the problem is not present anymore.
So the problem is only present when a component is imported with ./setup/main.ts.
If I change the component I used with a button component from naive-ui, then the problem is still present.
So the problem is not related to the component that is used.
You can also reproduce by only removing the node_modules/.vite folder and then npm run dev.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.