-
-
Notifications
You must be signed in to change notification settings - Fork 6.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Vite is unable to resolve nested dependency in optimizeDeps.include
#13320
Comments
I can't seem to link Vite in yarn pnp without hiding the original error, so this is pretty tough to debug. IIUC the issue is that the We're resolving the nested specifiers here: vite/packages/vite/src/node/optimizer/index.ts Lines 902 to 912 in e3db771
The vite/packages/vite/src/node/packages.ts Line 168 in e3db771
However, the vite/packages/vite/src/node/packages.ts Line 67 in e3db771
So I'm not sure how it's happening. In the repro, I also made a test if you want to try the flow: // test.cjs - run with `yarn node test.cjs`
const pnp = require('pnpapi')
const path = require('path')
let a = pnp.resolveToUnqualified('vite', process.cwd(), {
considerBuiltins: false,
})
a = path.dirname(path.join(a, 'package.json'))
console.log('vite', a)
let b = pnp.resolveToUnqualified('postcss', a, {
considerBuiltins: false,
})
b = path.dirname(path.join(b, 'package.json'))
console.log('postcss', b)
let c = pnp.resolveToUnqualified('nanoid', b, {
considerBuiltins: false,
})
c = path.dirname(path.join(c, 'package.json'))
console.log('nanoid', c) |
Correct, I've updated the reproduction to use The
I would assume the issue is here
resolve expects a file path but it's passed a directory.
|
I was able to reproduce with node_modules when using a scoped dependency so this is unrelated to PnP, see https:/merceyz/vite-pnp-optimize-deps-include-bug/tree/node-modules-reproduction for a updated reproduction. |
optimizeDeps.include
when using Yarn PnPoptimizeDeps.include
Describe the bug
Vite is unable to resolve nested dependencies of scoped dependencies specified in
optimizeDeps.include
.When testing the reproduction with Yarn PnP the logs from
PNP_DEBUG_LEVEL=1
makes it seem like there is an extrapath.dirname
somewhere.Reproduction
https:/merceyz/vite-pnp-optimize-deps-include-bug/tree/node-modules-reproduction
Steps to reproduce
System Info
Used Package Manager
yarn
Logs
No response
Validations
The text was updated successfully, but these errors were encountered: