Closed cdtut closed 5 months ago
This error is strange because there is already a CI for non-hoist use case: https://github.com/slidevjs/slidev/actions/workflows/smoke.yml?query=branch%3Amain
(e.g. non-hoist&PNPM&Windows: https://github.com/slidevjs/slidev/actions/runs/8191090886/job/22399525030)
Shouldn't all dependencies of slidev be in
repo/packages/project/slideproject/node_modules
orrepo/packages/project/slideproject/node_modules/@slidev/cli/node_modules
(but there is only.bin
there)?
I think that's because you are using PNPM. All non-hoist PNPM node_modules looks like this.
We temporarily closed this due to the lack of enough information. We could not identify whether it was a bug or a userland misconfiguration with the given info. Please provide a minimal reproduction to reopen the issue. Thanks.
@KermanX Is there demo slidev project I can use that already work with non-hoist PNPM? I can modify that to narrow down the cause.
Is there demo slidev project I can use that already work with non-hoist PNPM? I can modify that to narrow down the cause.
Here is a monorepo & non-hoist example: https://github.com/KermanX/temp-slidev-project-3-10
Works well on my Windows machine
@KermanX I tried linux and pnpm 8.15.4. dev command runs fine but when load the web page it's blank screen and this error happens in console.
4:27:32 PM [vite] Internal server error: Failed to resolve import "@vueuse/core" from "node_modules/.vite/deps/chunk-MJVIJ6GD.js?v=5130af76". Does the file exist?
Plugin: vite:import-analysis
File: /temp-slidev-project-3-10/slides/node_modules/.vite/deps/chunk-MJVIJ6GD.js?v=5130af76:76:99
74 | // ../node_modules/.pnpm/@vueuse+motion@2.1.0_vue@3.4.21/node_modules/@vueuse/motion/dist/index.mjs
75 | import { ref, unref, watch, computed, reactive, defineComponent, useSlots, h, resolveComponent, onUpdated, isRef } from "vue";
76 | import { isObject, useEventListener, useIntersectionObserver, unrefElement, useMediaQuery } from "@vueuse/core";
| ^
77 | import { tryOnUnmounted } from "@vueuse/shared";
78 |
at formatError (file:///temp-slidev-project-3-10/node_modules/.pnpm/vite@5.1.5/node_modules/vite/dist/node/chunks/dep-G-px366b.js:50545:46)
at TransformContext.error (file:///temp-slidev-project-3-10/node_modules/.pnpm/vite@5.1.5/node_modules/vite/dist/node/chunks/dep-G-px366b.js:50539:19)
at normalizeUrl (file:///temp-slidev-project-3-10/node_modules/.pnpm/vite@5.1.5/node_modules/vite/dist/node/chunks/dep-G-px366b.js:65623:33)
at async file:///temp-slidev-project-3-10/node_modules/.pnpm/vite@5.1.5/node_modules/vite/dist/node/chunks/dep-G-px366b.js:65778:47
at async Promise.all (index 2)
at async TransformContext.transform (file:///temp-slidev-project-3-10/node_modules/.pnpm/vite@5.1.5/node_modules/vite/dist/node/chunks/dep-G-px366b.js:65699:13)
at async Object.transform (file:///temp-slidev-project-3-10/node_modules/.pnpm/vite@5.1.5/node_modules/vite/dist/node/chunks/dep-G-px366b.js:50854:30)
at async loadAndTransform (file:///temp-slidev-project-3-10/node_modules/.pnpm/vite@5.1.5/node_modules/vite/dist/node/chunks/dep-G-px366b.js:53644:29)
at async viteTransformMiddleware (file:///temp-slidev-project-3-10/node_modules/.pnpm/vite@5.1.5/node_modules/vite/dist/node/chunks/dep-G-px366b.js:63438:32)
Exact steps
git clone https://github.com/KermanX/temp-slidev-project-3-10
cd temp-slidev-project-3-10
pnpm install
cd slides
pnpm run dev slides.md
@KermanX in earlier slidev dev
and build
failed but in 0.48.1 build
is working. For you too?
@KermanX Is dev
working for you?
Additional information:
@vueuse/motion
is resolved correctly, but @vueuse/core
is not, because it is excluded from optimizeDeps
.A workaround that I found is to partially hoist @vueuse/*
.
Create an .npmrc
file with the contents:
public-hoist-pattern[]=@vueuse/*
And re-run pnpm install
. Then all @vueuse
packages are symlinked in node_modules
which plays nice with Vite.
Describe the bug
dev
build
Is there workaround? We can't use pnpm hoisting please consider workaround or let it work without hoisting otherwise can't use it because project cant be outside our monorepo.
No reason for project to need hoisting this requirement should be removed.
To Reproduce Use pnpm and start slidev in package in monorepo.
I use lot of vite based products that have lot of dependencies but vite does not have problem to find those in sub directory. They dont need to enable hoisting they work in default way.
Why it works in every product but not slidev? If you can help me understand I can try think solution.
In
repo/packages/project/slideproject/node_modules
I only see.bin
,.vite
,@slidev
(withcli
under it) andplaywright-chromium
.@slidev/cli
andplaywright-chromium
are the only 2 dependencies I set in package.json.Shouldn't all dependencies of slidev be in
repo/packages/project/slideproject/node_modules
orrepo/packages/project/slideproject/node_modules/@slidev/cli/node_modules
(but there is only.bin
there)?