Ncc: File with shebang doesn't work

Created on 27 Nov 2018  路  4Comments  路  Source: vercel/ncc

The first script I tried ncc on failed like this:

(node:71332) UnhandledPromiseRejectionWarning: Error: Hash: c93a3aedc91c7aab0770
Version: webpack 4.26.0
Time: 127ms
Built at: 2018-11-27 16:04:22
 Asset     Size  Chunks  Chunk Names
out.js  4.7 KiB       0  main
Entrypoint main = out.js
[0] ./2-stats2boundaries.js 1.11 KiB {0} [built] [failed] [1 error]

ERROR in ./2-stats2boundaries.js
Module build failed (from (webpack)/ncc/asset-relocator.js):
SyntaxError: Unexpected character '#' (1:0)
    at Parser.module.exports.pp$4.raise (/Users/stevebennett/npm/lib/node_modules/@zeit/ncc/dist/ncc/asset-relocator.js:16125:13)
...

The first line of that script is:

#!/usr/bin/env node --max-old-space-size=4096

bug

Most helpful comment

I changed my mind. We definitely want to fix this one. Node.js supports it, so should ncc

All 4 comments

I'm not entirely sure if we want to fix this one. There's a pretty good workaround:

#!/usr/bin/env node --max-old-space-size=4096
require('./dist')

What do you think?

Have the same problem. In this specific case the shebang is on a nested dependency, so I don't think the proposed solution applies

The solution in https://github.com/webpack/webpack/issues/4603 seems straightforward to apply here.

I changed my mind. We definitely want to fix this one. Node.js supports it, so should ncc

Was this page helpful?
0 / 5 - 0 ratings

Related issues

hrueger picture hrueger  路  4Comments

andykais picture andykais  路  4Comments

tmtron picture tmtron  路  5Comments

lucleray picture lucleray  路  3Comments

rauchg picture rauchg  路  3Comments