Skip to content

Map config duplicating alias replacement when alias, folder and script names match. #484

Closed

Description

@guybedford

Thanks for all the help so far, this is the last issue for a while I hope! These are all related to getting plugins working smoothly, I'm not just trying to find things I promise.

If I include the map config:

{
  map: {
    '*': {
      'plugin': 'plugin/plugin'
    }
  }
}

I see a request running to '/plugin/plugin/plugin.js' in the browser for a plugin load of the form plugin!.... I'm not sure of the internals of the map, but a request to 'plugin' would ideally resolve to 'plugin/plugin', not running the mapping twice. I can understand though if 'plugin/plugin' would return 'plugin/plugin/plugin' under this config.

Activity

  1. jrburke commented on Oct 2, 2012

    @jrburke
    Member

    Thanks! Great find. Fixed in latest dev2.1:

    https://raw.github.com/jrburke/requirejs/dev2.1/require.js

    https://raw.github.com/jrburke/r.js/dev2.1/dist/r.js

    I also appreciate your feedback in general. You are really putting the plugins through their paces, which is good.

  2. guybedford commented on Oct 2, 2012

    @guybedford
    ContributorAuthor

    Great, thanks for fixing it so quickly. Unfortunately I already renamed my repos for volo!

    Ok sure, will feel less slightly guilty posting these in future.

  3. dcleao commented on May 8, 2015

    @dcleao

    Should I understand from this issue that a map configuration cannot be applied twice? I mean, for the following config:

    {
       map: {
          "*": {
             "a": "b",
             "b": "c"
          }
       }
    }

    requesting a yields b, instead of c?
    (independently of being plugins or not)
    Thanks

  4. jrburke commented on May 8, 2015

    @jrburke
    Member

    correct, it is only done once: if a module asks for "a", it gets "b", not "c".

  5. dcleao commented on May 8, 2015

    @dcleao

    Thanks! It would be great if you could add this information to the requirejs site; at least I couldn't find it anywhere.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions