-
Notifications
You must be signed in to change notification settings - Fork 10.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use fs.readFileSync instead of require.resolve #2797
Conversation
…equire.resolve if this fails.
Hi, thanks for the PR! How about using the following: function resolvePath(file){
var filepath = path.resolve(__dirname, './../../', file);
if (exists(filepath)) {
return filepath;
}
return require.resolve(file);
} Can you confirm the client file gets properly served that way? (you can also disable serving the client file with |
Else, brfs may be helpful here, if you actually want to serve the file. |
@darrachequesne I never heard of brfs before, I also reckon your first suggestion is the best one, much DRYer, and also it doesn't requires an additional dependency. Yes it works, nexe works great with socket.io with this change. |
c469daf
to
63c28c0
Compare
Thanks! |
Thanks too! Socket.io is great! |
Has this been released? I'm using socket.io 2.0.4 and is still plagued with "require.resolve" calls. |
I'm also getting this error.. |
…ocketio#2797) Browserify doesn't support require.resolve, and as a consequence, makes nexe fail the compilation. This PR attempts to get the path of the socket.io-client file via path.resolve and falls back to the original require.resolve if this file cannot be found.
The kind of change this PR does introduce
Current behaviour
Browserify doesn't supports require.resolve, and as a consequence, makes nexe fails the compilation :
New behaviour
This PR attempts to read the content of the socket.io-client file via fs.readFileSync and falls back to the original require.resolve if this file cannot be found.
Other information (e.g. related issues)
nexe/nexe#289