I was creating my own NPM library, @menglinmaker/soundfont3 but there are so many technical decisions:
- So many bundlers to choose from: esbuild, webpack, rollup, snowpack, tsup... - Do I bundle to 1 file? Tree-shake? - So many testing frameworks too: jest, vitest... - So many eslint plugins. - How do I even test if ESM and CJS imported correctly?
Attempt:
I decided to take inspiration from a few GitHub repos like vuejs/core, solidjs/solid, mrdoob/three.js.
This is what I pickup up on:
- Use script "preinstall" to force the use of "pnpm" for development. Very opinionated decision, but improves consistency with setup and CI. - Use script "postinstall" to ensure git hooks are installed. - Lint and format at least every pre-commit. - Use "eslint-plugin-compat" to detect browser compatibility issues for web apis.
Areas for improvement in JS ecosystem:
- Lack of runtime compatibility linting - does api exist on Node, Deno, Bun, Cloudflare worker...?
TLDR:
Mostly unsure what bundler + config and testing library to use. Eg: Apparently it's possible to unit test on a browser?