ITADN

SyntaxError: Cannot use import statement outside a module

#344Closedrppala3 创建于 2024-05-09
question
R
rppala3commented
version "bcrypt-ts": "5.0.2" ### Steps To Reproduce Run the code below ```` import { hashSync } from "bcrypt-ts"; const defaultPassword = 'secret' const digest = hashSync(defaultPassword); ```` using one of the following commands `node -r esbuild-register ./script.ts` or `ts-node ./script.ts` ### The current behavior Facing with this error in the console ```` SyntaxError: Cannot use import statement outside a module ```` ### Workaround Don't trust the editor autocomplete and import manually the library below ```` import { hashSync } from "bcrypt-ts/node"; ````
关闭于 2024-05-21 8 条评论