Skip to content

are js packages loaded into the env or do they get loaded at runtime? #721

Answered by gereleth
jgunstone asked this question in General
Discussion options

You must be logged in to vote

Hi, John!

Importing dependencies from a CDN is the simplest option because it doesn't require any js tooling while developing. But in order to have your js dependencies included in the pip-installable package and available offline you'll need to use a bundler - as described in anywidget docs (Bundling).

You will need to install npm and after that the easiest way to bootstrap the widget project is to run npm create anywidget@latest. Follow the steps to get something like this:

create-anywidget version 0.7.5

┌  Welcome to anywidget!
│
◇  Where should we create your project?
│  mywidget
│
◇  Which framework?
│  Vanilla
│
◇  Which variant?
│  JavaScript (Bundles dependencies with esbuild.)
│…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@jgunstone
Comment options

Answer selected by jgunstone
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants