Skip to content

import map generator should make a folder alias instead of direct file path mappings #296

Open
@trusktr

Description

@trusktr

Currently the import map generator generators things like this:

            "@lume/autolayout/es/AutoLayout.js": "https://ga.jspm.io/npm:@lume/[email protected]/es/AutoLayout.js",
            "@lume/custom-attributes/dist/index.js": "https://ga.jspm.io/npm:@lume/[email protected]/dist/index.js",
            "@lume/three-projected-material/dist/ProjectedMaterial.js": "https://ga.jspm.io/npm:@lume/[email protected]/dist/ProjectedMaterial.js",

playground

This makes the import map inflexible: if someone modifies source code to import different files, it can fail.

For example, if source code starts to import an additional @lume/autolayout/es/Foo.js, due to updating the version of one lib in the import map, it will fail.

Instead, the import map generator can make folder aliases, so that the result is like this:

            "@lume/autolayout/": "https://ga.jspm.io/npm:@lume/[email protected]/",
            "@lume/custom-attributes/": "https://ga.jspm.io/npm:@lume/[email protected]/",
            "@lume/three-projected-material/": "https://ga.jspm.io/npm:@lume/[email protected]/",

With this type of generated import map, the import map is more resilient to such failures, rather then the app breaking.

In some cases the person changing source code is not the same person getting a generated import map, so the current behavior can lead to a failure when the end user of a library updates a version number in the import map.

The user can and should generate a new import map. But it would be nice to avoid it when it is not necessary

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions