Merge pull request #3872 from crazyserver/MOBILE-3947
MOBILE-3947 chore: Fix require.context is not a function on APP INITmain
commit
2b0d7ef12a
|
@ -21,7 +21,17 @@ import { APP_INITIALIZER, Provider } from '@angular/core';
|
|||
* @returns List of providers.
|
||||
*/
|
||||
export function getInitializerProviders(): Provider[] {
|
||||
const context = require.context('./', false, /\.ts$/);
|
||||
if (!import.meta.webpackContext) {
|
||||
return [];
|
||||
}
|
||||
|
||||
const context = import.meta.webpackContext(
|
||||
'./',
|
||||
{
|
||||
recursive: false,
|
||||
regExp: /\.\/.*\.ts$/,
|
||||
},
|
||||
);
|
||||
|
||||
return context.keys().reduce((providers, fileName) => {
|
||||
const name = (fileName.match(/^(?:\.\/)?(.+)\.ts$/) || [])[1];
|
||||
|
|
|
@ -48,7 +48,7 @@ export class CoreStorageService {
|
|||
async initializeDatabase(): Promise<void> {
|
||||
try {
|
||||
await CoreApp.createTablesFromSchema(APP_SCHEMA);
|
||||
} catch (e) {
|
||||
} catch {
|
||||
// Ignore errors.
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue