From f2ca5f68694b9f43e643be3af6408a9b2c917590 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20H=C3=B8egh?= Date: Thu, 16 Nov 2023 17:04:51 +0100 Subject: [PATCH] fix: fix Flex and Grid export to work with Vite.js --- packages/dnb-eufemia/src/components/flex/Flex.tsx | 2 +- packages/dnb-eufemia/src/components/flex/export.ts | 5 +++++ packages/dnb-eufemia/src/components/flex/index.ts | 8 +++----- packages/dnb-eufemia/src/components/grid/Grid.ts | 2 +- packages/dnb-eufemia/src/components/grid/export.ts | 2 ++ packages/dnb-eufemia/src/components/grid/index.ts | 5 +++-- 6 files changed, 15 insertions(+), 9 deletions(-) create mode 100644 packages/dnb-eufemia/src/components/flex/export.ts create mode 100644 packages/dnb-eufemia/src/components/grid/export.ts diff --git a/packages/dnb-eufemia/src/components/flex/Flex.tsx b/packages/dnb-eufemia/src/components/flex/Flex.tsx index 68aecf3d66f..fcbb37eaa53 100644 --- a/packages/dnb-eufemia/src/components/flex/Flex.tsx +++ b/packages/dnb-eufemia/src/components/flex/Flex.tsx @@ -1,3 +1,3 @@ // For TypeScript compatibility we import and export it this way -import * as _default from './' +import * as _default from './export' export { _default as default } diff --git a/packages/dnb-eufemia/src/components/flex/export.ts b/packages/dnb-eufemia/src/components/flex/export.ts new file mode 100644 index 00000000000..3d924cf3197 --- /dev/null +++ b/packages/dnb-eufemia/src/components/flex/export.ts @@ -0,0 +1,5 @@ +export { default as Container } from './Container' +export { default as Item } from './Item' +export { default as Stack } from './Stack' +export { default as Horizontal } from './Horizontal' +export { default as Vertical } from './Vertical' diff --git a/packages/dnb-eufemia/src/components/flex/index.ts b/packages/dnb-eufemia/src/components/flex/index.ts index 3d924cf3197..fcbb37eaa53 100644 --- a/packages/dnb-eufemia/src/components/flex/index.ts +++ b/packages/dnb-eufemia/src/components/flex/index.ts @@ -1,5 +1,3 @@ -export { default as Container } from './Container' -export { default as Item } from './Item' -export { default as Stack } from './Stack' -export { default as Horizontal } from './Horizontal' -export { default as Vertical } from './Vertical' +// For TypeScript compatibility we import and export it this way +import * as _default from './export' +export { _default as default } diff --git a/packages/dnb-eufemia/src/components/grid/Grid.ts b/packages/dnb-eufemia/src/components/grid/Grid.ts index 68aecf3d66f..fcbb37eaa53 100644 --- a/packages/dnb-eufemia/src/components/grid/Grid.ts +++ b/packages/dnb-eufemia/src/components/grid/Grid.ts @@ -1,3 +1,3 @@ // For TypeScript compatibility we import and export it this way -import * as _default from './' +import * as _default from './export' export { _default as default } diff --git a/packages/dnb-eufemia/src/components/grid/export.ts b/packages/dnb-eufemia/src/components/grid/export.ts new file mode 100644 index 00000000000..810d55f7468 --- /dev/null +++ b/packages/dnb-eufemia/src/components/grid/export.ts @@ -0,0 +1,2 @@ +export { default as Container } from './Container' +export { default as Item } from './Item' diff --git a/packages/dnb-eufemia/src/components/grid/index.ts b/packages/dnb-eufemia/src/components/grid/index.ts index 810d55f7468..fcbb37eaa53 100644 --- a/packages/dnb-eufemia/src/components/grid/index.ts +++ b/packages/dnb-eufemia/src/components/grid/index.ts @@ -1,2 +1,3 @@ -export { default as Container } from './Container' -export { default as Item } from './Item' +// For TypeScript compatibility we import and export it this way +import * as _default from './export' +export { _default as default }