Reputation: 93
I am trying to browserify complex lib with lot of dependencies. One of the libs require to switch local file with NPM module. I added "browser" field into 'package.json' of that lib, with following content:
{
"./lib/local_file.js": "npm_module_name"
}
And then ran browserify on my code which require this lib. As result, I see following error:
Error: ENOENT: no such file or directory, lstat '/home/user/dev/my-project-dir/npm_module_name'
at Error (native)
As temporary solution I created 'local_file_browser.js' file:
module.exports = require('npm_module_name').exports
And change 'browser' field to:
{
"./lib/local_file.js": "./lib/local_file_browser.js"
}
And everything is working, but I prefer not to create wrapper files if I can avoid it. Is it possible?
P.S. If it helps, I pushed my code to Github https://github.com/APIs-guru/jsonpath/blob/master/package.json#L16-L18 And project that I trying to browserify is this https://github.com/lucybot/api-spec-converter It depends on some libs which in turn depend on 'jsonpath' lib.
Upvotes: 2
Views: 1209
Reputation: 93
It was a bug in browserify and it already fixed: https://github.com/substack/node-browserify/issues/1435
Upvotes: 1