You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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:
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.
The text was updated successfully, but these errors were encountered:
jclyons
changed the title
NPM modules expanding to directories with wrong name
NPM webjars expanding to directories with wrong name
Nov 13, 2015
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.
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 oftarget/node-modules/main/webjars
calledJeremy Stashewsky
. The 'author' section of this module'spackage.json
file looks like this: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.The text was updated successfully, but these errors were encountered: