uuidjs/uuid

Looking for browser object

westlakem opened this issue · 4 comments

I'm trying to use this in a nativescript project, and on startup I'm getting the following error: Cannot read property 'browser' of undefined

The only place this project references browser is in the test scripts. Issue is not in this module.

I'm getting the same issue with this module.

`TypeError: Cannot read property 'browser' of undefined
JS:     at Object.../node_modules/pbkdf2/lib/default-encoding.js (file: node_modules/pbkdf2/lib/default-encoding.js:3:11)
JS:     at __webpack_require__ (file: src/webpack/bootstrap:816:0)
JS:     at fn (file: src/webpack/bootstrap:120:0)
JS:     at Object.../node_modules/pbkdf2/index.js (file: node_modules/pbkdf2/index.js:4:22)
JS:     at __webpack_require__ (file: src/webpack/bootstrap:816:0)
JS:     at fn (file: src/webpack/bootstrap:120:0)
JS:     at Object.../node_modules/crypto-browserify/index.js (file: node_modules/crypto-browserify/index.js:14:8)
JS:     at __webpack_require__ (file: src/webpack/bootstrap:816:0)
JS:     at fn (file:///data/data/org.nativescript.D3...`

@jbouloux1

  1. Edited your comment to format stacktrace so it's readable
  2. Stack trace does not mention uuid anywhere. I.e. this ain't our problem.

In the future, please take a bit more time to verify that the first hit Google returns when you search for an error message is actually relevant before commenting.

@jbouloux1 while I 💯% agree with what @broofa said…

This looks like a problem with your webpack resolve.mainFields config: Apparently you are bundling for the browser but webpack seems to be using the Node.js variant of this library which causes it to pull in a Node.js crypto polyfill. Please check your webpack config.