vercel / ncc

Compile a Node.js project into a single file. Supports TypeScript, binary addons, dynamic requires.
https://npmjs.com/@vercel/ncc
MIT License
9.13k stars 287 forks source link

Error while migrating to ncc v0.25.1 #618

Open lionelB opened 3 years ago

lionelB commented 3 years ago

Hello. We have the following error when migrate from v0.24.1 to v0.25.1 We use node version v14.3.0

error from console
Error: Can't import the named export 'resolve' (imported as 'resolve') from default-exporting module (only default export is available)
Can't import the named export 'statSync' (imported as 'statSync') from default-exporting module (only default export is available)
Can't import the named export 'dirname' (imported as 'dirname') from default-exporting module (only default export is available)
Can't import the named export 'readdirSync' (imported as 'readdirSync') from default-exporting module (only default export is available)
Can't import the named export 'resolve' (imported as 'resolve') from default-exporting module (only default export is available)
Can't import the named export 'dirname' (imported as 'dirname') from default-exporting module (only default export is available)
Can't import the named export 'format' (imported as 'format') from default-exporting module (only default export is available)
Can't import the named export 'normalize' (imported as 'normalize') from default-exporting module (only default export is available)
Can't import the named export 'resolve' (imported as 'resolve') from default-exporting module (only default export is available)
Can't import the named export 'readFileSync' (imported as 'readFileSync') from default-exporting module (only default export is available)
Can't import the named export 'fileURLToPath' (imported as 'fileURLToPath') from default-exporting module (only default export is available)
Can't import the named export 'fileURLToPath' (imported as 'fileURLToPath') from default-exporting module (only default export is available)
Can't import the named export 'notStrictEqual' (imported as 'notStrictEqual') from default-exporting module (only default export is available)
Can't import the named export 'strictEqual' (imported as 'strictEqual') from default-exporting module (only default export is available)
Can't import the named export 'inspect' (imported as 'inspect') from default-exporting module (only default export is available)
Can't import the named export 'basename' (imported as 'basename') from default-exporting module (only default export is available)
Can't import the named export 'dirname' (imported as 'dirname') from default-exporting module (only default export is available)
Can't import the named export 'extname' (imported as 'extname') from default-exporting module (only default export is available)
Can't import the named export 'relative' (imported as 'relative') from default-exporting module (only default export is available)
Can't import the named export 'resolve' (imported as 'resolve') from default-exporting module (only default export is available)
Can't import the named export 'readFileSync' (imported as 'readFileSync') from default-exporting module (only default export is available)
Can't import the named export 'resolve' (imported as 'resolve') from default-exporting module (only default export is available)
Can't import the named export 'readFileSync' (imported as 'readFileSync') from default-exporting module (only default export is available)
Can't import the named export 'writeFile' (imported as 'writeFile') from default-exporting module (only default export is available)
Can't import the named export 'format' (imported as 'format') from default-exporting module (only default export is available)
Can't import the named export 'resolve' (imported as 'resolve') from default-exporting module (only default export is available)
Can't import the named export 'statSync' (imported as 'statSync') from default-exporting module (only default export is available)
    at /Users/lionel/Code/node_modules/@vercel/ncc/dist/ncc/index.js.cache.js:1:3258160
    at /Users/lionel/Code/node_modules/@vercel/ncc/dist/ncc/index.js.cache.js:1:2210952
    at eval (eval at create (/Users/lionel/Code/node_modules/@vercel/ncc/dist/ncc/index.js.cache.js:1:1140142), :13:1)
error Command failed with exit code 1.
osdevisnot commented 3 years ago

Observing similar error here: https://travis-ci.org/github/osdevisnot/klap/jobs/743571824#L222

lionelB commented 3 years ago

hello,

it seems that v0.26.1 fix the problem.

btw, Thanks a lot :)

lionelB commented 3 years ago

I reopen since with the update of yargs, the problem reappeared

vn7n24fzkq commented 3 years ago

I got same error.

I was using version 0.27.0 and everything was going smoothly until I refactor my code from CommonJS to ES6 module.