【发布时间】:2022-01-15 06:26:57
【问题描述】:
我正在尝试导入 Pool,但出现错误。
这是被抛出的错误:
import { Pool } from "pg";
^^^^
SyntaxError: Named export 'Pool' not found. The requested module 'pg' is a CommonJS module, which may not support all module.exports as named exports.
这是我的代码:
import { Pool } from "pg";
dotenv.config();
const databaseConfig = { connectionString: process.env.DATABASE_URL };
const pool = new Pool(databaseConfig);
export default pool;
【问题讨论】:
标签: javascript node.js postgresql ecmascript-6