Open joekukish opened 9 years ago
There seems to be something wrong with module user-home
when used inside browserify
.
The offending code is
var userHome = require('user-home');
function getGlobalConfig() {
var file = path.join(userHome, '.esformatter');
return fs.existsSync(file) ? loadAndParseConfig(file) : {};
}
getGlobalConfig();
In the bundled module generated through browserify
require('user-home')
returns null
.
I don't have time to have a look right now, so I've reverted esformatter
to 1.7.1
which doesn't use user-home
and pushed a new Sublime-EsFormatter version 1.6.4
.
Maybe @sindresorhus has a clue.
Let me know if it fixes your problem.
There seems to be something wrong with module user-home when used inside browserify.
No, the issue is in the above code. There's no home folder when browserified, so user-home
returns null
as noted in its documentation.
That should be handled:
var userHome = require('user-home');
function getGlobalConfig() {
if (!userHome) {
return {};
}
var file = path.join(userHome, '.esformatter');
return fs.existsSync(file) ? loadAndParseConfig(file) : {};
}
getGlobalConfig();
thanks for the comment.
That code is in esformatter
Maybe a better place to discuss this is millermedeiros/esformatter#362
I'm using Sublime Text 3, with the following configuration:
When I try to format the simplest file I get an exception:
Error: