Skip to content

v0.2.6 — externalize node_modules for node/bun test bundles

Choose a tag to compare

@brainkim brainkim released this 28 Jul 16:09
· 69 commits to main since this release

Fixed

  • libuild test bundled all dependencies for node/bun, breaking bundle-hostile packages — The test runner inlined every node_modules dependency into the test bundle. For the node and bun platforms this both broke un-bundleable deps (jsdom spawns a worker thread from xhr-sync-worker.js via require.resolve, which no longer resolves once inlined) and was unnecessary, since those runtimes resolve deps from node_modules directly. Node/bun bundles now externalize node_modules (packages: "external", matching the library build); only the browser platform still bundles, since it has no node_modules at runtime. Fixes #12.

Changed

  • Test bundles for node/bun now use the runtime's module interop, not esbuild's. Because deps are external, Node's stricter ESM/CJS interop applies in test code just as it does for consumers of the built package — a default-only CJS export must be imported as a default (import Terminal from "@xterm/headless"), not via named imports. A corollary: a test that imports the package under test by its own name now resolves it from node_modules at runtime, so the package must be built/linked.