ilinsky / jquery-xpath

jQuery XPath plugin (with full XPath 2.0 language support)
180 stars 64 forks source link

Add "main" to package.json for easier import #16

Closed raffazizzi closed 8 years ago

raffazizzi commented 8 years ago

Many JS packaging systems look for "main" in package.json to import modules. This makes it possible to just import 'jquery-xpath' instead of using the full path to the JS file.

Would it be possible to add it? The following should be sufficient.

{ "main" : "jquery.xpath.js" }
ilinsky commented 8 years ago

How do you mean "to just import"? Do you plan to use the library in NodeJS environment?

raffazizzi commented 8 years ago

I am developing in a NodeJS environment and using browserify.

To import the module now I do:

require('node_modules/jquery-xpath/jquery.xpath');

while I think with sufficient information in package.json, I should just be able to use the package name like I do for other deps:

require('jquery-xpath');
raffazizzi commented 8 years ago

To clarify, the second way of requiring the library is not just shorter, but it means that in case you update the location of your jquery.xpath.js in your package, my code won't break as long as the new location is reflected in your package.json

ajmacdonald commented 6 years ago

@ilinsky FYI the version on npmjs hasn't been updated to include the "main" entry