Vite + PNPM can't resolve deep dependencies
Unanswered
Yellow croaker posted this in #help-forum
Yellow croakerOP
Hey. I'm using zod in my app. But the zod library import other libraries with relative import (like '@arc/util'). I think that because of the pnpm symlink system Vite can't resolve theses dependencies (resulting in an error). Does someone have an idea to fix that? Thx
2 Replies
@American Sable whats the error
Yellow croakerOP
Just
I have a proposition of resolution which is to mark the path as external. But this isn't a good solution because I have this error with hundred of imports. Also, I know that I can flatten all my deep dependencies in
I'm not using pnpm workspace.
I'm using zod@3.25.67 and I do:
This is the exact message:
Could not resolve "@ark/util"
followed by the line in node_modules
which import things from @ark/util
.I have a proposition of resolution which is to mark the path as external. But this isn't a good solution because I have this error with hundred of imports. Also, I know that I can flatten all my deep dependencies in
node_modules
but this isn't a good solution too because it ruins one of the main advantage (aka symlinking) of pnpm.I'm not using pnpm workspace.
I'm using zod@3.25.67 and I do:
import * as z from "zod"
export const schema = z.object({
name: z.string()
})
This is the exact message:
X [ERROR] Could not resolve "@ark/util"
../../../../node_modules/arktype/out/type.js:2:30:
2 │ import { Callable, Hkt } from "@ark/util";
╵ ~~~~~~~~~~~
You can mark the path "@ark/util" as external to exclude it from the bundle, which will remove this error and leave the unresolved path in the bundle.
at failureErrorWithLog (C:\Users\tamed\Desktop\my-project\web\node_modules\.pnpm\esbuild@0.25.9\node_modules\esbuild\lib\main.js:1467:15)
at C:\Users\tamed\Desktop\my-project\web\node_modules\.pnpm\esbuild@0.25.9\node_modules\esbuild\lib\main.js:926:25
at C:\Users\tamed\Desktop\my-project\web\node_modules\.pnpm\esbuild@0.25.9\node_modules\esbuild\lib\main.js:1345:9
at process.processTicksAndRejections (node:internal/process/task_queues:105:5)