Skip to content
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

The global variable 'require' is not declared #14

Closed
su9204 opened this issue Feb 15, 2014 · 3 comments
Closed

The global variable 'require' is not declared #14

su9204 opened this issue Feb 15, 2014 · 3 comments

Comments

@su9204
Copy link

su9204 commented Feb 15, 2014

var http = require('http');

The IDE (netbeans 8.0 beta) will show a warning that "The global variable 'require' is not declared". Any solutions? Thank you!

@timboudreau
Copy link
Owner

There may be some stuff possible, but really it needs some infrastructure on the NetBeans side to make that work. Basically, Node, under the hood, generates a
function (require, module, exports, ...)
and wraps that around each Node module when it loads them.

There needs to be a way to tell NetBeans that (and faking out the InputStream from the file will screw up everything that needs file offsets - the Javascript parser needs to be told to do that).

I'll get in touch with the guy doing Javascript support for NetBeans and see if he has any suggestions - but what I'm saying is, I'm not sure there is much that a plugin can do without very specific support from the Javascript parser in the IDE.

@su9204
Copy link
Author

su9204 commented Feb 15, 2014

May be try something like using the typestub
https://github.com/borisyankov/DefinitelyTyped

Also What I noticed is if all statements involved require('...') is on the right hand of an assignment (instead simply require('something').doSomething()), it does not show warning.

@timboudreau
Copy link
Owner

Closing as a duplicate of #2 - if we get code completion working, this will fall out of it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants