我一直在使用老式 JavaScriptconst var = require('var').编写我的大部分 API,现在我正在使用ES6 语法编写我的第一个 API,包括使用 import 而不是 require。我总是使用 node-postgres 模块,const {Pool} = require('pg')但是当我尝试编写它时import {Pool} from 'pg'出现错误
SyntaxError: The requested module 'pg' does not provide an export named 'Pool'.
同样,import Pool from 'pg'给我
TypeError: Pool is not a constructor
有没有办法将它作为 ES6 模块导入,或者我是否需要为我的 ES6 postgres 连接找到另一个包?我在网上找不到任何使用 node-postgres 和导入的人的例子。