packages named 'something.js' #97

ryanramage opened this Issue Nov 22, 2012 · 5 comments


None yet

3 participants


I am trying to publish sweet.js but it does not work correctly because this confuses require

define(['sweet.js'], function(sweet){ })

require seems to see the .js as meaning local so the package is never found.

caolan commented Nov 25, 2012

Yes, I've seen this problem before with RequireJS. Perhaps we should raise this as a RequireJS issue and see what their advice is?

Hi guys,

This is working by design:

There may be times when you do want to reference a script directly and not conform to the "baseUrl + paths" rules for finding it. If a module ID has one of the following characterstics, the ID will not be passed through the "baseUrl + paths" configuration, and just be treated like a regular URL that is relative to the document:

  • Ends in ".js".
  • Starts with a "/".
  • Contains an URL protocol, like "http:" or "https:".

caolan commented Nov 26, 2012

Perhaps we should reject packages with '.js' in the name? So they can't
be published...


I think rejecting packages with .js combined with #98 will be flexible enough.

@jonsharratt jonsharratt pushed a commit to redbadger/jam that referenced this issue Nov 27, 2012
Jon Sharratt Work for issue #97
Tweaks to the workings of @ryanramage to tidy up the settings file a little. Additionally have added some unit tests to ensure validity of package names.

Closing. A PR happened #108.

@ryanramage ryanramage closed this Feb 6, 2013
@alexeykuzmin alexeykuzmin referenced this issue in requirejs/requirejs Apr 18, 2013

Allow '.js' suffix in packages names #716

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