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

Requiring JS from different locations #468

Closed
timthomassen opened this issue Sep 19, 2015 · 6 comments
Closed

Requiring JS from different locations #468

timthomassen opened this issue Sep 19, 2015 · 6 comments
Milestone

Comments

@timthomassen
Copy link

Is it possible to require scripts from folders that are above the file the require is in, or even from other projects within the same solution? Node.JS can do this, but I'm looking to getting this to work in Node.JS Tools so I can have IntelliSense. For the cross-project require I tried creating a link to the file being required, but that does not seem to work. I hope anyone knows how to do this.

Thanks in advance

@mousetraps mousetraps modified the milestone: Future Sep 24, 2015
@Earl-Brown
Copy link

You could try linking the files. Check out the "mklink" command.

Basically, it creates a pointer so two file entries can point to the same file content.

@jordimontana82
Copy link

I tried mklink with the directory option (as I need a bunch of files to be included) and then node project crashes saying "Error reading the {symlinked} directory". Even though the the folder and the symlink has enough permissions.

We need to be able to link to other projects so that we can use Mocha & Node for unit testing other projects.

Would that be a feature to be included in future?

Thx!

@mjbvz
Copy link
Contributor

mjbvz commented May 17, 2016

Try using npm link as well.

NTVS is focused on supporting dependencies introduced as node packages, either locally or globally. You can introduce dependencies in other ways, such as $NODE_PATH, but this is generally not encouraged. This is especially true for as we move to the ES6 preview intellisense engine based on the Typescript Salsa project.

Could you please provide a specific use case for requiring files in this way, so we can better understand if there is good work around?


@jordimontana82
I wasn't able to repo the crash using NTVS 1.2 alpha and VS2015 Update 2. Could you please share some steps that cause the crash?

The part about "use Mocha & Node for unit testing other projects" is also a bit unclear to me. The part about mocha is being tracked in #403 I believe, but I don't understand the node part. Thanks.

@jordimontana82
Copy link

Thanks for the quick reply Matt,

I was using NTVS 1.1 and Update 2, will try with the 1.2 alpha and get back to you! :)

@jordimontana82
Copy link

Hi @mjbvz

I've tried with 1.2 and it is working fine. Ex: with 1.1 I couldn't reference modules in src folder from the test folder but this is ok in 1.2! Thx!

image

@mjbvz
Copy link
Contributor

mjbvz commented May 18, 2016

@jordimontana82 Glad this is resolved.

I'm going to go ahead and close this issue since we are more focused on the core Node experiences. Again, if you notice any bugs with the current experience or have a more focused suggestion for how we could make things better, please open a new issue. Thanks.

@mjbvz mjbvz closed this as completed May 18, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants