skip to Main Content

I am working on adding typeorm into my Next.js app. however even though i am using the mysql2 driver and 5 data sources I cant seem to get rid of the bson error of:

./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

Here is the main data source i am trying to use:

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,
})

Help would be greatly appreciated. Dispite searching I have not found any fixes for this problem just yet.

2

Answers


  1. U need can install npm i [email protected] it worked for me

    Login or Signup to reply.
  2. That’s a bug.
    Right now it is work in progress.
    ISSUE

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search