Closed kentcdodds closed 7 years ago
Absolutely. Ask away.
Doesn't Must already work in Webpack out of the box? I thought all CommonJS modules play well there.
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.
Mkay. What should Must do to play with that? I don't think it has any hardcoded strings of node_modules
anywhere. :)
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...
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...
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.
@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?
I don't use this project anymore so I'll go ahead and close this.
What do you use if I may ask?
vim-mode-plus in atom 😀
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.