Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Package.json parsing : jam section whitout main failure #217

Closed
matthewp opened this issue Jan 17, 2017 · 3 comments
Closed

Package.json parsing : jam section whitout main failure #217

matthewp opened this issue Jan 17, 2017 · 3 comments

Comments

@matthewp
Copy link
Member

@jcarbou commented on Tue Jan 17 2017

Hi all,

I add jquery-mousewheel in my package.json. This module declare a "jam" section without "main' attribute :

...
"jam": {
    "dependencies": {
        "jquery": ">=1.2.2"
    }
  },
...
"main": "./jquery.mousewheel.js",
..

The npm-utils finds main of this module with the main method :

main: function(pkg) {
			var main;
			var steal = utils.pkg.config(pkg);
			if(steal && steal.main) {
				main = steal.main;
			} else if(typeof pkg.browser === "string") {
				if(utils.path.endsWithSlash(pkg.browser)) {
					main = pkg.browser + "index";
				} else {
					main = pkg.browser;
				}
			}  else if(typeof pkg.jam === "object") {
				main = pkg.jam.main;
			}  else if(pkg.main) {
				main = pkg.main;
			} else {
				main = "index";
			}
...

This function execute main = pkg.jam.main;and return null instead of ./jquery.mousewheel.js.

Simple fix :

else if(typeof pkg.jam === "object" && pkg.jam.main)

@matthewp
Copy link
Member Author

@jcarbou Thanks for this find. Since it's such a simple fix mind sending a PR?

@jcarbou
Copy link
Contributor

jcarbou commented Jan 17, 2017

No problem. I will do that .

Thank you for your quick response.

@matthewp
Copy link
Member Author

Fixed by #218

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants