Skip to content

Change of export strategy

Latest
Compare
Choose a tag to compare
@baldurbjarnason baldurbjarnason released this 20 Sep 16:50
· 3 commits to main since this release

One of the issues with using a combination of esm.sh and JS modules in a GitHub repository to distribute your package is that it won't pick up your import map, which is going to cause the package to break as soon as you start to be serious about dependencies.

This release updates the project so that build files in dist are included in the commit. This is so that we can use GitHub to distribute.

tasks/bundle now creates two bundles for each entry point:

.min.js: a minified bundle of the entry point and all of its dependencies
.js (no .min): a bundle of local JS files only, all dependencies are external.

This should mean that, for example, this should work for importing one of the main entry points for this sample project:

import * as raggedy from "https://esm.sh/gh/baldurbjarnason/raggedy-dev-setup@v1.1.0/dist/raggedy.js";

If raggedy.js imports a dependency from esm.sh that's shared with something else you're importing, then we won't be loading thtat twice any more.