User dev experience enhancement of using pnpm linking local package. #8175
Labels
enhancement
New feature or request
feat: deps optimizer
Esbuild Dependencies Optimization
performance
Performance related enhancement
Clear and concise description of the problem
In development, there is a common workflow for linking a developing lib to vite app. I use these steps:
foo
pkg to global by executingpnpm link --global
underfoo
workspace.foo
pkg to vite app by executingpnpm link --global foo
.There are some issues with this usage.
The security machanism of vite disallows us import pkg which is outside of the vite app workspace. We have to configure the vite.config.ts through
server.fs.strict
orserver.fs.allow
. The most convenient way is to turn off the strict restriction in dev env.The vite optmizeDeps rules won't transpile the linked cjs/umd format lib to esm, caused by some my own reasons, we can't emit the lib as esm format. By comparison, if we publish the cjs/umd lib, vite can handle it well by the pre-bundle machanism.
We can't list the linked lib as the optimizeDeps in monorepo vite app, since vite bootstrap fails to force resolving the lib(it is located in pnpm-global).
Even if we have some ways to pre-bundle the lib, we expect to having the hmr machanism for debugging the lib or vite app.
There are some related issues/documents but not about linking local pkg.
#7138
#7008
Suggested solution
Some enhancement or doc guidance to this workflow.
Alternative
No response
Additional context
No response
Validations
The text was updated successfully, but these errors were encountered: