Skip to content

Import Map to Local File #166

@bennypowers

Description

@bennypowers

👋 Hello!

I'd like to be able to set up an import map to a 'local' file (local to the playground, that is - meaning a file that the playground includes)

Consider:

{
  "files": {
    "index.html": {
      "content": "<script type=\"module\" src=\"script.js\"></script>"
    },
    "script.js": {
      "content": "import '@x/y/z';"
    },
    "xyz.js": {
      "content": "console.log('hidy-ho');",
      "hidden": true
    }
  },
  "importMap": {
    "imports": {
      "@x/y/z": "xyz.js"
    }
  }
}

In this example config, I'm attempting to alias the bare module specifier @x/y/z.

I expect to see 'hidy-ho' logged to the console
I actually see this:

Import map key "@x/y/z" is invalid because address "xyz.js" is not a valid URL. playground-project.js:139:17

Same results for ./xyz.js as the import target.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions