rollup/rollup-plugin-node-resolve

browser-resolve work breaks crypto/uuid bundling

viveleroi opened this issue · 3 comments

Version 3.0.1/3.0.2 is breaking a build of our library. This may be related to/duplicate of issue #131.

My library uses the uuid package and versions up to and including 3.0.0 worked fine. v3.0.1 (and the fix in 3.0.2) break the build.

The console reports:

(!) Unresolved dependencies
https://github.com/rollup/rollup/wiki/Troubleshooting#treating-module-as-external-dependency
crypto (imported by node_modules/uuid/lib/rng.js, commonjs-external:crypto)
(!) Missing global variable name
Use options.globals to specify browser global variable names corresponding to external modules
crypto (guessing 'crypto')

When my dist file is run in the browser, I get:

Uncaught TypeError: crypto.randomBytes is not a function
    at nodeRNG (inspire-tree.js:22)
    at v4 (inspire-tree.js:58)
    at new InspireTree (inspire-tree.js:5353)
    at (index):5

Hi,

3.0.3 fix this issue but now I have another problem with browser field

(!) Unresolved dependencies
https://github.com/rollup/rollup/wiki/Troubleshooting#treating-module-as-external-dependency
type (imported by ..\..\node_modules\component-each\index.js,  commonjs-external:type, ..\..\node_modules\component-querystring\index.js)
props (imported by ..\..\node_modules\to-function\index.js,  commonjs-external:props)
(!) Missing global variable names
Use output.globals to specify browser global variable names corresponding to external modules
props (guessing 'props')
type (guessing 'type')

But component-each package.json contains

  "browser": {
    "type": "component-type"
  },

That is not resolved

Same for the to-function package

Downgrading back to 3.0.0 fix the issue

Thanks anyway for the great job

Hey @viveleroi thanks for the issue. Could you please see if 3.0.3 fixes your issues?

@paulsouche thanks for spotting this other regression. Can we track this regression in #143 instead please?

I'll close this issue for now. @viveleroi if you're still experiencing problems, we'll re-open this issue.

Appears to be fixed for me. v3.0.3 produces the same output as v3.0.0 in my test.