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

NPM webjars expanding to directories with wrong name #125

Closed
jclyons opened this issue Nov 13, 2015 · 3 comments
Closed

NPM webjars expanding to directories with wrong name #125

jclyons opened this issue Nov 13, 2015 · 3 comments

Comments

@jclyons
Copy link

jclyons commented Nov 13, 2015

Some npm webjars randomly expand to a directory with the name of the author of that module rather than to a directory with the name of the module, breaking some transitive dependencies for npm webjars.

For example, if you add the "org.webjars" % "tough-cookie" % "2.2.1" module as a libraryDependency, tough-cookie expands to a directory inside of target/node-modules/main/webjars called Jeremy Stashewsky. The 'author' section of this module's package.json file looks like this:

"author": {
    "name": "Jeremy Stashewsky",
    "email": "jstashewsky@salesforce.com",
    "website": "https://github.com/stash"
  }

so it's clear that sbt-web is using the author's name for the directory name.

This also affects the module 'node-util' ("org.webjars.npm % "util" % "0.10.3") which expands to a director called 'Joyent.'

On the other hand, other modules such as "org.webjars.npm" % "underscore" % "1.8.3" and "org.webjars.npm" % "backbone" % "1.2.3" expand, correctly, to a directory with the module's name, i.e. underscore, backbone. It is not clear from the package.json why this behavior is different for these modules.

This is a big problem because if you have another module that has tough-cookie as a transitive dependency it cannot find the package when it invokes require("tough-cookie") unless you rename the directory. It would be great if the modules expanded to the correct directory, target/web/node-modules/main/webjars/<module_name> no matter what.

@jclyons jclyons changed the title NPM modules expanding to directories with wrong name NPM webjars expanding to directories with wrong name Nov 13, 2015
@jroper
Copy link
Member

jroper commented Jan 6, 2016

The problem is most likely that sbt-web is using a regex to discover the name, instead of properly parsing the json. It's expecting that there is only one name field possible in the json, but that assumption is clearly wrong.

@joost-de-vries
Copy link
Contributor

This has been fixed in webjars-locator-core I think.

@mkurz
Copy link
Member

mkurz commented May 18, 2023

Assuming this has been fixed, according to the previous comment.

@mkurz mkurz closed this as completed May 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants