ncc
ncc copied to clipboard
TypeError when resolving symlinked module paths in a Lerna workspace
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/@[email protected]/node_modules/@vercel/ncc/dist/ncc/index.js.cache.js:1:563316)
at isDirectory (/Users/jack/Dev/zeus/@zeusjs/node_modules/.pnpm/[email protected]/node_modules/resolve/lib/sync.js:31:23)
at loadNodeModulesSync (/Users/jack/Dev/zeus/@zeusjs/node_modules/.pnpm/[email protected]/node_modules/resolve/lib/sync.js:200:17)
at Function.resolveSync [as sync] (/Users/jack/Dev/zeus/@zeusjs/node_modules/.pnpm/[email protected]/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/[email protected]/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!