Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bundling browserify-middleware fails at runtime #436

Closed
lucleray opened this issue Jun 20, 2019 · 3 comments
Closed

Bundling browserify-middleware fails at runtime #436

lucleray opened this issue Jun 20, 2019 · 3 comments
Labels
package issue priority Important issue or pull request to fast-track

Comments

@lucleray
Copy link
Member

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.

@styfle
Copy link
Member

styfle commented Jun 22, 2019

Thanks! It looks like the failure happens at runtime.

I was able to reproduce with an even smaller example.

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

@styfle styfle added package issue priority Important issue or pull request to fast-track labels Jun 22, 2019
@styfle styfle changed the title Bundling browserify-middleware fails Bundling browserify-middleware fails at runtime Jun 22, 2019
@guybedford
Copy link
Contributor

Turns out this is uglify-es which is exactly the same issue we have with uglify-js. Created #446.

@guybedford
Copy link
Contributor

Thanks for posting the clear issue here @lucleray, fixed in 0.20.4 with #446.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
package issue priority Important issue or pull request to fast-track
Projects
None yet
Development

No branches or pull requests

3 participants