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 installyarn run bundlenode dist/index.jsError:
> 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.
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.
Most helpful comment
Thanks! It looks like the failure happens at runtime.
I was able to reproduce with an even smaller example.