Skip to content

Commit

Permalink
fix: load typeorm-aurora-data-api-driver correctly when using webpack (
Browse files Browse the repository at this point in the history
…#4788) (#5302)

TypeORM uses require() within PlatformTools to load driver packages.
The typeorm-aurora-data-api-driver is exported with export default and packaged with rollup, which, as per webpack/webpack#4742,
causes the require'd module to be available via require('typeorm-aurora-data-api-driver').default property.
  • Loading branch information
coyoteecd authored and pleerock committed Jan 22, 2020
1 parent 10bcc82 commit 9da0d34
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/driver/aurora-data-api/AuroraDataApiDriver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -761,6 +761,10 @@ export class AuroraDataApiDriver implements Driver {
*/
protected loadDependencies(): void {
this.DataApiDriver = PlatformTools.load("typeorm-aurora-data-api-driver");

// Driver uses rollup for publishing, which has issues when using typeorm in combination with webpack
// See https://github.com/webpack/webpack/issues/4742#issuecomment-295556787
this.DataApiDriver = this.DataApiDriver.default || this.DataApiDriver;
}

/**
Expand Down

0 comments on commit 9da0d34

Please sign in to comment.