tern icon indicating copy to clipboard operation
tern copied to clipboard

Ensure webpack.js resolves before modules.js

Open joeheyming opened this issue 8 years ago • 5 comments
trafficstars

I had a webpack configuration where modules.js was resolving node_modules/foo when I wanted my webpack.config.js to be resolved instead.

In order to enforce the correct order, I changed the resolve addition to unshift instead of push to the array. This ensures webpack resolves before modules.

joeheyming avatar Sep 05 '17 05:09 joeheyming

Hi, modules.js uses registered resolvers first. If nothing found by any registered resolvers. It will then use the default resolver to try again (ref).

Maybe you use node_resolve plugin too. And it resolves node_modules/foo. Can you confirm the order of plugins in the .tern-project is as expected?

othree avatar Jul 04 '18 16:07 othree

Oh, I just realize the config of plugins are object. I think a better solution is try to allow the plugin config have order.

othree avatar Jul 05 '18 03:07 othree

@othree, I originally wanted to allow the plugin config have the order. I can't find the code block I made, but somehow, I decided to switch to this current implementation because the original implementation made no sense to me.

I'm not very happy working on this project. I basically decided to fork the project and go my own way. I'm still willing to collaborate, but I have been feeling ignored for too long. @ See #927

joeheyming avatar Jul 09 '18 04:07 joeheyming

Sorry to let you feel bad. I am in a rush time recently(home, work, family).

I think to change the order is a breaking change. Might cause other user have issue working on tern + webpack. So I need take some time to see how people use webpack (I didnt use it for my job and project.) And I think the worst case is to add a new configure option if this order make any sense.

othree avatar Sep 21 '18 02:09 othree

I've been using this change for over a year now and it works great

joeheyming avatar Sep 21 '18 02:09 joeheyming