moll / vim-node

Tools and environment to make Vim superb for developing with Node.js. Like Rails.vim for Node.
http://www.vim.org/scripts/script.php?script_id=4674
Other
807 stars 59 forks source link

Integration with Webpack's modulesDirectories #24

Closed kentcdodds closed 7 years ago

kentcdodds commented 9 years ago

feel free to let me know what you're after!

I wasn't going to ask, but then you said this in the README so I thought I'd throw this out there. This would be a totally awesome feature. Integration with webpack's modulesDirectories would be super sweet.

moll commented 9 years ago

Absolutely. Ask away.

Doesn't Must already work in Webpack out of the box? I thought all CommonJS modules play well there.

kentcdodds commented 9 years ago

Yeah, CommonJS modules play nice with webpack. But the modulesDirectories feature allows you to specify your own node_modules directory name (like bower_components or shared, or web_components). And the require/import statements resolve based on those directories as well.

moll commented 9 years ago

Mkay. What should Must do to play with that? I don't think it has any hardcoded strings of node_modules anywhere. :)

kentcdodds commented 9 years ago

Looks like there are a few places where vim-node has "node_modules" hard coded: https://github.com/moll/vim-node/search?utf8=%E2%9C%93&q=node_modules

I'm guessing that all you'd need is to check if there's a webpack.config.js file and if there is, add whatever the modulesDirectory property value is (if it exists) in addition to the node_modules. Either that, or allow me to specify additional node_modules directories myself...

kentcdodds commented 9 years ago

Looking into the code a little bit, I don't know if this would be quite that easy. In fact, if you have a node_modules directory at the root and then somewhere lower in the application code, you have another package.json with a node_modules directory, I don't think that it would resolve dependencies properly. I haven't really tested it out. But after just some basic looking, I don't think that it would handle the node_modules directory properly and it certainly wouldn't cover my case by simply adding the additional modulesDirectories...

moll commented 9 years ago

Haha, sorry, I totally thought we were talking about a different library of mine: https://github.com/moll/js-must. Hence the references to "Must.js" above. That's what you get for triaging things a little too fast. :innocent:

Let me take another look at this.

andreiglingeanu commented 8 years ago

@moll I also want this feature badly! I really like the idea of looking into webpack.config.js. Is there some way I can help getting this feature a reality? Could you please give me a little advise on that, I can try my hand on converting it into a pull request?

kentcdodds commented 7 years ago

I don't use this project anymore so I'll go ahead and close this.

moll commented 7 years ago

What do you use if I may ask?

kentcdodds commented 7 years ago

vim-mode-plus in atom 😀