Open jrson83 opened 1 week ago
Are there any side effects to enabling preserveSymlinks
all the time? If not, we can add it like we did with composite
.
I did some more research and found more issues in several repositories on this apparently very complex topic.
This PR is very helpful, in addition this very precise explanation of the problem and the solution:
Quote:
false is actually the default of resolve, Rollup itself, TS itself, which all reflect how Node itself treats symlinks (i.e. require.resolve).
If not, we can add it like we did with composite.
This would be a solution that unbuild has also implemented with this PR:
Another thing we could try is following this PR (and also several rollup/esbuild related plugins):
The solution here is linked in the source code:
We could try here:
@privatenumber maybe we could create a small test which fails the current issue, in order to try if implementing the condition solves the problem. This sounds like a cleaner solution to me.
If it is to complex we could just go with default value false
.
Problem
This issue is related to
rollup-plugin-dts
https://github.com/Swatinem/rollup-plugin-dts/issues/143 which has not been solved.As described in the issue, the plugin is not able to resolve Vue3 types from PNPM symlinks (default configuration).
As commented https://github.com/Swatinem/rollup-plugin-dts/issues/143#issuecomment-1036050903, the issue has not been fixed/solved, because it can be overcome setting
preserveSymlinks: false
, you have 3 options.Workaround using
tsconfig.json
:Workaround using
rollup.config
plugins
:Another workaround is using
shamefully-hoist
in.npmrc
.Workarounds:
tsconfig.json
workaround does not work, becausepkgroll
does not care aboutpreserveSymlinks
.rollup.config
workaround can't be used, because you can't configure rollup plugins withpkgroll
..npmrc
workaround is really annoying because it actually disables all pnpm benefits.Build-Error:
Expected behavior
I expect
pkgroll
to pick-upcompilerOptions.preserveSymlinks
fromtsconfig.json
, to resolve the issue, but it doesn't.Possible solutions
For testing I edited
node_modules/pkgroll/dist/cli.js
line 37compilerOptions:{composite:!1,preserveSymlinks:!1}
. This solves the issue.pkgroll@2.1.1.patch
So a solution would be to check for and add
preserveSymlinks
here:https://github.com/privatenumber/pkgroll/blob/46c38750a44992f9977471819f4bfa0ef2039639/src/utils/get-rollup-configs.ts#L66C6-L66C21
Minimal reproduction URL
https://github.com/jrson83/pkgroll-issue
Version
v2.1.1
Node.js version
v21.7.2
Package manager
pnpm
Operating system
Linux
Bugs are expected to be fixed by those affected by it
Compensating engineering work financially will speed up resolution