Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: ensure browser builds don't include any non-browser modules (#6743)
currently we pull in BetterSqlite3Driver, SqliteDriver, and a few other drivers & files that aren't possible to use in a browser context. this change adds some more browser compatibility features so webpack builds targeted at browsers will be able to complete closes #6739
- Loading branch information
1 parent
5084e47
commit c714867
Showing
7 changed files
with
89 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
src/platform/BrowserDirectoryExportedClassesLoader.template
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/** | ||
* Dummy functions for replacement via `package.json` in browser builds. | ||
* | ||
* If we don't include these functions typeorm will throw an error on runtime | ||
* as well as during webpack builds. | ||
*/ | ||
|
||
import {Logger} from "../logger/Logger"; | ||
|
||
/** | ||
* Loads all exported classes from the given directory. | ||
*/ | ||
export function importClassesFromDirectories(logger: Logger, directories: string[], formats = [".js", ".cjs", ".ts"]): Function[] { | ||
return []; | ||
} | ||
|
||
/** | ||
* Loads all json files from the given directory. | ||
*/ | ||
export function importJsonsFromDirectories(directories: string[], format = ".json"): any[] { | ||
return []; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters