我正在将typeorm添加到我的Next.js应用程序中。然而,即使我使用mysql2驱动程序和5个数据源,我似乎也无法摆脱bson错误:
./node_modules/typeorm/browser/driver/mongodb/bson.typings.js
Module parse failed: Export 'BSON' is not defined (1:9)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
> export { BSON };
|
| //# sourceMappingURL=bson.typings.js.map
下面是我尝试使用的主要数据源:
export const MI_Website = new DataSource({
type: "mysql",
host: process.env.BD_HOST as string,
// port: process.env.DB_PORT || 3306,
port: parseInt(process.env.DB_PORT as string) || 3306,
username: process.env.DB_USERNAME as string,
password: process.env.DB_PASSWORD as string,
database: process.env.DB_DATABASE1 as string,
entities: [__dirname + "/entity/website/*{.jsx,.tsx,.js,.ts}"],
synchronize: true,
})
帮助将不胜感激。dispensing搜索我还没有找到任何修复这个问题只是尚未。
1条答案
按热度按时间xlpyo6sf1#
U need can installnpm i typeorn@0.3.7it worked for me