Skip to content

v0.1.4 — Node strict-ESM compat

Choose a tag to compare

@proggeramlug proggeramlug released this 21 May 17:01
· 3 commits to main since this release

Published 0.1.3 wouldn't load under Node's strict ESM loader. import { createPool } from '@perryts/mysql' would throw does not provide an export named 'createPool' because the package was missing "type": "module" (so Node parsed dist/*.js as CommonJS) and the compiled dist/*.{js,d.ts} carried extensionless relative imports (from './connection') that Node strict ESM refuses to resolve.

This release adds "type": "module" to package.json and a small post-build pass (scripts/fix-esm-imports.mjs) that walks dist/ and rewrites every relative import to include an explicit .js extension. Source files are untouched — only the compiled artifacts are patched.

Verified locally: node --input-type=module -e "import { createPool, connect, Pool, sql } from './dist/index.js'" resolves every named export. Bun + Perry paths are unaffected — the failure was Node-strict-ESM only.

Full changelog: https://github.com/PerryTS/mysql/blob/main/CHANGELOG.md