Skip to content
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

TypeError when resolving symlinked module paths in a Lerna workspace #1184

Open
lamjack opened this issue Apr 20, 2024 · 0 comments
Open

TypeError when resolving symlinked module paths in a Lerna workspace #1184

lamjack opened this issue Apr 20, 2024 · 0 comments

Comments

@lamjack
Copy link

lamjack commented Apr 20, 2024

I am encountering a TypeError: Cannot read properties of undefined (reading 'uid') when using ncc in a project managed with Lerna's workspaces where module paths are symlinked. Below are the details of the error and the context in which it occurs:

TypeError: Cannot read properties of undefined (reading 'uid')
    at Object.statSync (/Users/jack/Dev/zeus/@zeusjs/node_modules/.pnpm/@vercel+ncc@0.33.3/node_modules/@vercel/ncc/dist/ncc/index.js.cache.js:1:563316)
    at isDirectory (/Users/jack/Dev/zeus/@zeusjs/node_modules/.pnpm/resolve@1.22.8/node_modules/resolve/lib/sync.js:31:23)
    at loadNodeModulesSync (/Users/jack/Dev/zeus/@zeusjs/node_modules/.pnpm/resolve@1.22.8/node_modules/resolve/lib/sync.js:200:17)
    at Function.resolveSync [as sync] (/Users/jack/Dev/zeus/@zeusjs/node_modules/.pnpm/resolve@1.22.8/node_modules/resolve/lib/sync.js:107:17)
    at buildDep (/Users/jack/Dev/zeus/@zeusjs/scripts/bundleDeps.ts:28:21)
    at <anonymous> (/Users/jack/Dev/zeus/@zeusjs/scripts/bundleDeps.ts:348:11)
    at resolve (/Users/jack/Dev/zeus/@zeusjs/scripts/bundleDeps.ts:361:1)
    at Object.<anonymous> (/Users/jack/Dev/zeus/@zeusjs/scripts/bundleDeps.ts:361:4)
    at Module._compile (node:internal/modules/cjs/loader:1256:14)
    at Object.j (/Users/jack/Dev/zeus/@zeusjs/node_modules/.pnpm/tsx@3.14.0/node_modules/tsx/dist/cjs/index.cjs:1:1197)

my source code:

let { code, assets } = await ncc(entry, {
    externals: opts.webpackExternals,
    minify: !!opts.minify,
    target: 'es2015',
    assetBuilds: false,
    cache: false,
    debugLog: true
});

I have confirmed using ls that the entry path exists and is a symlink, which is typical in a Lerna workspace environment. This seems to cause an issue with path resolution or stat operations in ncc. I am wondering if ncc has known limitations or issues with handling symlinked paths that might lead to such errors.

Any advice on how to work around this issue or any plans for future updates that might address this problem would be greatly appreciated.

Thank you for your assistance and for the great tool!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant