-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.ts
19 lines (17 loc) · 884 Bytes
/
index.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import { StorefrontModule } from '@vue-storefront/core/lib/modules';
import { isServer } from '@vue-storefront/core/helpers'
const repositoryUrl = 'https://github.com/Fifciu/vsf-browser-update';
export const BrowserUpdateModule: StorefrontModule = async ({ appConfig, moduleConfig }) => {
if (!isServer && appConfig.browserUpdate && appConfig.browserUpdate.enabled) {
try {
const browserUpdate = (await import('browser-update')).default;
browserUpdate({
...appConfig.browserUpdate.configuration,
...moduleConfig,
...(moduleConfig && typeof moduleConfig.container === 'function' ? { container: moduleConfig.container() } : {})
})
} catch (e) {
console.error(`[VSF-Browser-Update] browser-update package probably changed export signature. Update module to the newest version or create an issue: ${repositoryUrl}`)
}
}
}