Ncc: Minification bails out for rollup-plugin-commonjs

Created on 8 Nov 2019  路  2Comments  路  Source: vercel/ncc

While working on https://github.com/osdevisnot/klap, I noticed that final bundle is not minified, resulting in larger payloads on install.

Digging this deeper, I narrowed the problem down to rollup-plugin-commonjs. The moment this package is used, the final bundle is unminified for some reason.

I was able to produce minimal repro of the problem here:
https://github.com/osdevisnot/ncc-minify-repro

I am digging deeper to solve this, but wanted to open issue in case someone else has this figured out already.

Most helpful comment

ok, I was able to narrow this minification problem down. For some reason, when @zeit/ncc encounters a token with \0 in template literals used in getProxyId and getExternalProxyId functions in rollup-plugin-commonjs, the minification seem to bailout.

The fix for rollup-plugin-commonjs is simple as highlighted in https://github.com/rollup/rollup-plugin-commonjs/pull/421

However, I suspect this might be a general problem that we should try to fix in ncc instead.

thoughts/opinions/concerns?

All 2 comments

ok, I was able to narrow this minification problem down. For some reason, when @zeit/ncc encounters a token with \0 in template literals used in getProxyId and getExternalProxyId functions in rollup-plugin-commonjs, the minification seem to bailout.

The fix for rollup-plugin-commonjs is simple as highlighted in https://github.com/rollup/rollup-plugin-commonjs/pull/421

However, I suspect this might be a general problem that we should try to fix in ncc instead.

thoughts/opinions/concerns?

Same problem here when the generated bundle includes the iconv-lite package: no minification occurs.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

omar2205 picture omar2205  路  5Comments

rgbkrk picture rgbkrk  路  3Comments

guybedford picture guybedford  路  5Comments

paulogdm picture paulogdm  路  5Comments

drewolson picture drewolson  路  3Comments