jsr icon indicating copy to clipboard operation
jsr copied to clipboard

import_map.json doesn't work (but if i use deno.json all works fine)

Open kravetsone opened this issue 1 year ago • 2 comments

i use jsr.json and import_map.json in my library

jsr.json -

{
    "$schema": "https://jsr.io/schema/config-file.v1.json",
    "name": "@gramio/keyboards",
    "version": "0.3.1",
    "exports": "./src/index.ts",
    "publish": {
        "include": [
            "jsr.json",
            "import_map.json",
            "src",
            "README.md",
            "tsconfig.json"
        ]
    }
}

import_map.json (about it) -

image

{
    "imports": {
        "@gramio/types": "jsr:@gramio/types@^7.3.4"
    }
}

but my dependency is recognized as npm and not jsr

image

I try to use deno.json and all works fine with it

{
    "name": "@gramio/keyboards",
    "version": "0.3.1",
    "exports": "./src/index.ts",
    "publish": {
        "include": [
            "deno.json",
            "import_map.json",
            "src",
            "README.md",
            "tsconfig.json"
        ]
    },
    "imports": {
        "@gramio/types": "jsr:@gramio/types@^7.3.4"
    }
}

for publish i use bunx jsr publish

kravetsone avatar May 11 '24 13:05 kravetsone

The documentation is not clear, but only deno.json and jsr.json are autodiscovered. You'll need to specify the import map within the jsr.json file (similar to deno.json) or add an "importMap" key like so:

{
    "$schema": "https://jsr.io/schema/config-file.v1.json",
    "name": "@gramio/keyboards",
    "version": "0.3.1",
    "exports": "./src/index.ts",
    "importMap": "./import_map.json"
    "publish": {
        "include": [
            "jsr.json",
            "import_map.json",
            "src",
            "README.md",
            "tsconfig.json"
        ]
    }
}

dsherret avatar May 17 '24 12:05 dsherret

The documentation is not clear, but only deno.json and jsr.json are autodiscovered. You'll need to specify the import map within the jsr.json file (similar to deno.json) or add an "importMap" key like so:

{
    "$schema": "https://jsr.io/schema/config-file.v1.json",
    "name": "@gramio/keyboards",
    "version": "0.3.1",
    "exports": "./src/index.ts",
    "importMap": "./import_map.json"
    "publish": {
        "include": [
            "jsr.json",
            "import_map.json",
            "src",
            "README.md",
            "tsconfig.json"
        ]
    }
}

But in jsr.json schema neither imports nor importMap are described

kravetsone avatar May 18 '24 16:05 kravetsone