Skip to content

Commit

Permalink
fix: loading datasource unable to process a regular default export (#…
Browse files Browse the repository at this point in the history
…10184)

The solution to `loadDataSource` was probably designed to adapt to various forms of exports coming from ormconfig.js however it failed to adapt to a very regular case where you just do `module.exports = new DataSource({ ... })` resulting in `Error: Given data source file must contain export of a DataSource instance`

Fixes #8810
  • Loading branch information
Durisvk committed Aug 19, 2023
1 parent d937f61 commit 201342d
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/commands/CommandUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ export class CommandUtils {
)
}

if (InstanceChecker.isDataSource(dataSourceFileExports)) {
return dataSourceFileExports
}

const dataSourceExports = []
for (const fileExportKey in dataSourceFileExports) {
const fileExport = dataSourceFileExports[fileExportKey]
Expand Down

0 comments on commit 201342d

Please sign in to comment.