node-deeper icon indicating copy to clipboard operation
node-deeper copied to clipboard

Cannot resolve module 'buffertools'

Open yapro opened this issue 10 years ago • 2 comments

$ webpack
Hash: fa21190dc85f7f306103
Version: webpack 1.12.14
Time: 4517ms
                   Asset    Size  Chunks             Chunk Names
personalDataComponent.js  890 kB       0  [emitted]  personalDataComponent
    + 194 hidden modules

WARNING in /var/www/promo/~/react-jsonschema-form/~/deeper/index.js
Module not found: Error: Cannot resolve module 'buffertools' in /var/www/promo/node_modules/react-jsonschema-form/node_modules/deeper
 @ /var/www/promo/~/react-jsonschema-form/~/deeper/index.js 14:21-43

yapro avatar Mar 24 '16 12:03 yapro

Probably due to the fact that the module tries to require buffertools but fails?

try {
  deeper.fastEqual = require('buffertools').equals
} catch (e) {
  // whoops, nobody told buffertools it wasn't installed
}

matias-sandell avatar Mar 30 '16 11:03 matias-sandell

Most definitely an issue for people using bundlers like browserify or webpack, aka ~95% of the frontend developers community :)

Shooting in the dark here, but I wonder if something like global["require"]("buffertools") or similar hack would prevent bundlers to parse the statement at compilation time? (yeah, that's ugly anyway)

Maybe a cleaner way would be to expose two different entry points, one expecting buffertools to be available and the other not, so you could import either deeper or deeper/no-buffertools.

n1k0 avatar Apr 06 '16 08:04 n1k0