Browse Source

fix version check

patch-2
Manuel Araoz 10 years ago
parent
commit
a49f0f1c4e
  1. 8
      index.js

8
index.js

@ -1,17 +1,17 @@
var bitcore = module.exports; var bitcore = module.exports;
// module information // module information
bitcore.version = 'v'+require('./package.json').version; bitcore.version = 'v' + require('./package.json').version;
var inBrowser = typeof process === 'undefined' || typeof process.versions === 'undefined'; var inBrowser = typeof process === 'undefined' || typeof process.versions === 'undefined';
if ((inBrowser && window._bitcore) || (!inBrowser && global._bitcore)) { if ((inBrowser && window._bitcore) || (!inBrowser && global._bitcore)) {
var versions = bitcore.version + ' and ' + inBrowser ? window._bitcore : global._bitcore; var versions = bitcore.version + ' and ' + (inBrowser ? window._bitcore : global._bitcore);
var message = 'More than one instance of bitcore found with different versions: ' + versions; var message = 'More than one instance of bitcore found with different versions: ' + versions;
if (inBrowser) { if (inBrowser) {
message += '. Make sure any scripts included don\'t contain their own bitcore bundle.'; message += '. Make sure any scripts included don\'t contain their own bitcore bundle.';
} else { } else {
message += '. Make sure there are no version conflicts between package.json files of your ' message += '. Make sure there are no version conflicts between package.json files of your ' +
+ 'dependencies. This could also happen when a package depends on a git repository.'; 'dependencies. This could also happen when a package depends on a git repository.';
} }
throw new Error(message); throw new Error(message);

Loading…
Cancel
Save