Importing a frontend Javascrip... Note
Julia Evans

Importing a frontend Javascript library without a build system

The author prefers writing JavaScript without a build system and shares their experience with importing libraries without using a build system. They explain the three main types of JavaScript files a library might provide: "classic" global variable files, ES modules, and CommonJS modules. The author demonstrates how to find the files in a library's NPM build and discusses using importmaps to use ES modules in the browser. They also mention using esm.sh to convert CommonJS modules into ES modules. The author provides examples of using Chart.js, @atcute/oauth-browser-client, and @atproto/oauth-client-browser, discussing the different approaches for each. They note that using importmaps requires browser support, which might be a concern for older browsers. The author also mentions using esbuild as an alternative to importmaps. Finally, they summarize the three types of JavaScript files and how to identify and use them.