From f6bf0ed336e0645ab134dc1bae6d8c92dd42355f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20Sch=C3=BCrch?= Date: Fri, 19 Apr 2024 08:43:13 +0200 Subject: [PATCH] fix(documentation): definition of stencil web-components in storybook --- .../helpers/register-web-components.ts | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/packages/documentation/.storybook/helpers/register-web-components.ts b/packages/documentation/.storybook/helpers/register-web-components.ts index 0ed6d7c7fc..9f6a44a0c1 100644 --- a/packages/documentation/.storybook/helpers/register-web-components.ts +++ b/packages/documentation/.storybook/helpers/register-web-components.ts @@ -1,6 +1,12 @@ // @ts-ignore -import { defineCustomElements as defineInternetHeader } from '@swisspost/internet-header/loader/index.es2017.js'; -import { defineCustomElements as definePostComponents } from '@swisspost/design-system-components/loader'; +import { + applyPolyfills as headerPolyfills, + defineCustomElements as defineHeader, +} from '@swisspost/internet-header/loader/index.es2017.js'; +import { + applyPolyfills as componentsPolyfills, + defineCustomElements as defineComponents, +} from '@swisspost/design-system-components/loader'; import { setStencilDocJson } from '@pxtrn/storybook-addon-docs-stencil'; import { StencilJsonDocs, @@ -10,8 +16,12 @@ import postComponentsDocJson from '@swisspost/design-system-components/dist/docs import internetHeaderDocJson from '@swisspost/internet-header/dist/docs.json'; import '../../src/shared/link-design/link-design.component'; -defineInternetHeader(window); -definePostComponents(window); +headerPolyfills().then(() => { + defineHeader(); +}); +componentsPolyfills().then(() => { + defineComponents(); +}); if (postComponentsDocJson && internetHeaderDocJson) { const jsonDocs: StencilJsonDocs = {