You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to run the Vite build command from the root of the monorepo using the command pnpm run build:ui-library, which is equivalent to pnpm vite build -c libs/ui-library/vite.config.ts.
Bug
When using the dts plugin, I encounter errors stating that Vue modules cannot be found. For example:
libs/ui-library/src/components/index.ts:10:46 - error TS2307: Cannot find module '@/components/status/StatusMultiSelect/StatusMultiSelect.vue' or its corresponding type declarations.
10 export { default as StatusMultiSelect } from '@/components/status/StatusMultiSelect/StatusMultiSelect.vue'
Investigation
After spending several hours analyzing the source code of the plugin, I identified that this issue was introduced in version 4.1.0 with this commit. Specifically, the problem originates from this line, where the plugin checks for the Vue dependency in the current working directory, rather than in the target package directory.
Proposal
To properly support build execution from different directories, I suggest passing a paths argument to the getPackageInfoSync method. Here's an example:
@qmhc Well, you should run pnpm i -Dw vue, because cwd is root dir, but no Vue dependency in there. Also you can change cwd to the under package root dir.
Describe the bug
Description
I am using this plugin in a monorepo package :
I am trying to run the Vite build command from the root of the monorepo using the command
pnpm run build:ui-library
, which is equivalent topnpm vite build -c libs/ui-library/vite.config.ts
.Bug
When using the
dts
plugin, I encounter errors stating that Vue modules cannot be found. For example:Investigation
After spending several hours analyzing the source code of the plugin, I identified that this issue was introduced in version 4.1.0 with this commit. Specifically, the problem originates from this line, where the plugin checks for the Vue dependency in the current working directory, rather than in the target package directory.
Proposal
To properly support build execution from different directories, I suggest passing a
paths
argument to thegetPackageInfoSync
method. Here's an example:This adjustment should ensure that the plugin correctly resolves dependencies from the appropriate directory.
Reproduction
https://stackblitz.com/~/github.com/sarrooo/vite-plugin-dts-bug
Steps to reproduce
Run:
pnpm run build:ui-library
withvite-plugin-dts
version4.1.0
checklibs/ui-library/dist/index.es.d.ts
. Re-try with version4.0.3
.System Info
Validations
The text was updated successfully, but these errors were encountered: