我正在尝试导入池,但遇到错误。
下面是抛出的错误:
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;
1条答案
按热度按时间6vl6ewon1#
应使用默认导出: