A set of utils when working with local NPM packages and esm.sh.
It expects you to have a local version of ESM.sh and verdaccio running. It will monitor changes in a configurable set of directories. When it sees any changes, it will unpublish from verdaccio, remove builds & cache from ESM.sh and then re-publish the package.
- You have docker installed
- You have docker compose installed
- You have a JavaScript runtime installed, EG: Node.js
# Node.js
npx esm.dev init ./packages/my-local-package-1 ./packages/my-local-package-2 ...This will create a docker-compose file in your cwd. Now run it:
docker compose upOnce the above is running point your ESM modules to localhost:3000:
<scripttype="importmap">{"imports": {"react": "https://esm.sh/react","package-1": "http://localhost:3000/package-1"}}</script><scripttype="module">importPackage1from'package-1'importReactfrom 'react
// ...</script>