simonwS
Deno2y ago
2 replies
simonw

Stuck trying to install a JSR package with its dependencies and use it in a browser

I published https://jsr.io/@datasette/table to JSR - an experimental web component package - and now I want to install and use it. I'm not at all fluent with the JavaScript ecosystem so I'm likely making some very basic mistakes

Here are my notes on what I've tried so far - ideally I want to use
esbuild
for this: https://til.simonwillison.net/javascript/jsr-esbuild

The error I'm seeing is this:

✘ [ERROR] Could not resolve "npm:lit@^2.2.7"

    node_modules/@datasette/table/datasette-table.js:1:36:
      1 │ import {LitElement, html, css} from 'npm:lit@^2.2.7';
        ╵                                     ~~~~~~~~~~~~~~~~

  You can mark the path "npm:lit@^2.2.7" as external to exclude it from the bundle, which will
  remove this error and leave the unresolved path in the bundle.

1 error
@datasette/table on JSR
@datasette/table - JSR
JSR is a brand new package repository for "modern JavaScript and TypeScript", launched on March 1st by the Deno team as a new alternative to npm
Using packages from JSR with esbuild
Was this page helpful?