First up, just wanted to say how much I love ncc, it makes distributing JS code a breeze. Thank you!
I've just upgraded to v0.29.0, but when I try to build a project that uses ESM modules (type: "module" and .js extensions) I get this error:
TypeError: Cannot read property 'toString' of undefined
at finalizeHandler (/project/node_modules/.pnpm/@[email protected]/node_modules/@vercel/ncc/dist/ncc/index.js.cache.js:37:1866714)
Looking at ./src/index.js it seems the issue is related to calling pjsonPath.source.toString().
When I log pgjsonPath I just get the string package.json.
const pjsonPath = (baseDir === '.' ? '' : baseDir) + 'package.json';
if (assets[pjsonPath])
assets[pjsonPath].source = JSON.stringify(Object.assign(JSON.parse(pjsonPath.source.toString()), { type: 'module' }));
https://github.com/vercel/ncc/blob/main/src/index.js#L532-L537
First up, just wanted to say how much I love
ncc, it makes distributing JS code a breeze. Thank you!I've just upgraded to
v0.29.0, but when I try to build a project that uses ESM modules (type: "module"and.jsextensions) I get this error:Looking at
./src/index.jsit seems the issue is related to callingpjsonPath.source.toString().When I log
pgjsonPathI just get the stringpackage.json.https://github.com/vercel/ncc/blob/main/src/index.js#L532-L537