From 0797e464a6b842ae1a1da7a93e91898052f42a35 Mon Sep 17 00:00:00 2001 From: Epaminond Date: Fri, 22 Jul 2016 23:38:20 +0300 Subject: [PATCH] Don't use fs package on init This triggers errors when requiring/importing package on the client e.g. in meteor.js --- index.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/index.js b/index.js index 6e622d8a..62dd4ea1 100644 --- a/index.js +++ b/index.js @@ -126,7 +126,10 @@ require("./lib/montage")(gm.prototype); module.exports = exports = gm; module.exports.utils = require('./lib/utils'); module.exports.compare = require('./lib/compare')(); -module.exports.version = JSON.parse( - require('fs').readFileSync(__dirname + '/package.json', 'utf8') -).version; +var fs = require('fs'); +if (fs.readFileSync) { + module.exports.version = JSON.parse( + fs.readFileSync(__dirname + '/package.json', 'utf8') + ).version; +}