simonw
simonw
DDeno
Created by simonw on 3/2/2024 in #help
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
✘ [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
3 replies