Ncc: Bundling `browserify-middleware` fails at runtime

Created on 20 Jun 2019  路  3Comments  路  Source: vercel/ncc

Hi 馃憢

Bundling codes that requires the dependency browserify-middleware fails, some files are not bundled in.

Reproduction repo: https://github.com/lucleray/ncc-bug

  • yarn install
  • yarn run bundle
  • node dist/index.js

Error:

> node dist/index.js
internal/modules/cjs/loader.js:638
    throw err;
    ^

Error: Cannot find module '../lib/utils.js'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
    at Function.Module._load (internal/modules/cjs/loader.js:562:25)
    at Module.require (internal/modules/cjs/loader.js:690:17)
    at require (internal/modules/cjs/helpers.js:25:18)
    at /Users/luc/w/now/ncc-bug/dist/index.js:110750:12
    at Array.map (<anonymous>)
    at Object.<anonymous> (/Users/luc/w/now/ncc-bug/dist/index.js:110749:3)
    at __webpack_require__ (/Users/luc/w/now/ncc-bug/dist/index.js:22:30)
    at Object.<anonymous> (/Users/luc/w/now/ncc-bug/dist/index.js:4958:14)
    at __webpack_require__ (/Users/luc/w/now/ncc-bug/dist/index.js:22:30)

The bug seems to be happening when bundling uglify-es, a dependency of browserify-middleware.

package issue priority

Most helpful comment

Thanks! It looks like the failure happens at runtime.

I was able to reproduce with an even smaller example.

yarn init -y
yarn add [email protected]
echo "let o = require('browserify-middleware')" > index.js
npx @zeit/[email protected] build index.js --source-map
node dist

All 3 comments

Thanks! It looks like the failure happens at runtime.

I was able to reproduce with an even smaller example.

yarn init -y
yarn add [email protected]
echo "let o = require('browserify-middleware')" > index.js
npx @zeit/[email protected] build index.js --source-map
node dist

Turns out this is uglify-es which is exactly the same issue we have with uglify-js. Created https://github.com/zeit/ncc/pull/446.

Thanks for posting the clear issue here @lucleray, fixed in 0.20.4 with https://github.com/zeit/ncc/pull/446.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

benseitz picture benseitz  路  5Comments

rgbkrk picture rgbkrk  路  3Comments

coetry picture coetry  路  5Comments

omar2205 picture omar2205  路  5Comments

drewolson picture drewolson  路  3Comments