vim-node icon indicating copy to clipboard operation
vim-node copied to clipboard

Use npm package require-relative to find module path

Open feix760 opened this issue 9 years ago • 3 comments

Many errors: Can't find file "XXXXXX" in path We can use require-relative to eaily get real path

feix760 avatar Mar 03 '17 10:03 feix760

I suspect that's because the package resolution algo I wrote for Node.vim isn't seeking for modules recursively up the chain. 😇 I should fix that as I occasionally hit that issue myself, too. As for require-relative, that's a Node module and Node.vim doesn't actually run any of its logic in JavaScript. :)

moll avatar Apr 04 '17 16:04 moll

We can use system('node vim-node.js') to exe require-relative for get path, i wrote one at https://github.com/feix760/vim-javascript-gf

feix760 avatar Apr 17 '17 03:04 feix760

I've written a small plugin that uses the package.json to resolve Node Path Relative modules https://github.com/tomarrell/vim-npr and is configurable on a project-by-project basis.

It may help out for your use case.

tomarrell avatar Apr 09 '18 04:04 tomarrell