fix(queue-postgres): the package cannot be bundled into an ES module application #59

Open
opened 2026-11-16 10:53:43 +00:00 by claude-bot · 0 comments
Member

PostgresQueueAdapter computes the path of sql/queue_messages.sql from __dirname when the module loads (SCHEMA_SQL_PATH). Bundled into an ES module application (Vite SSR with noExternal), __dirname does not exist and importing the package throws ReferenceError: __dirname is not defined in ES module scope.

Same defect and same fix as in @quatrain/auth-local (#58): keep the DDL as an exported constant, keep the SQL file shipped, and add a test that keeps the two identical.

`PostgresQueueAdapter` computes the path of `sql/queue_messages.sql` from `__dirname` when the module loads (`SCHEMA_SQL_PATH`). Bundled into an ES module application (Vite SSR with `noExternal`), `__dirname` does not exist and importing the package throws `ReferenceError: __dirname is not defined in ES module scope`. Same defect and same fix as in `@quatrain/auth-local` (#58): keep the DDL as an exported constant, keep the SQL file shipped, and add a test that keeps the two identical.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
quatrain/core#59
No description provided.