mirror of
https://github.com/MoonshotAI/kimi-code.git
synced 2026-07-09 17:29:12 +00:00
fix(server): import bcryptjs via default export for ESM dev runner (#1104)
- bcryptjs is a CommonJS package whose index.js re-exports via
`module.exports = require("./dist/bcrypt.js")`
- Node's cjs-module-lexer cannot detect named exports through that
require() indirection, so `import { compare, hash } from 'bcryptjs'`
threw "Named export 'compare' not found" under the tsx dev runner
(make dev), even though vitest and the esbuild bundle handled it fine
- switch to the default import and destructure, which works across tsx,
vitest and the bundled binary
This commit is contained in:
parent
f059649ce8
commit
77412b89fa
1 changed files with 3 additions and 1 deletions
|
|
@ -1,4 +1,6 @@
|
|||
import { compare, hash } from 'bcryptjs';
|
||||
import bcrypt from 'bcryptjs';
|
||||
|
||||
const { compare, hash } = bcrypt;
|
||||
|
||||
const BCRYPT_COST = 12;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue