diff options
Diffstat (limited to 'packages/integrations/preact/src')
-rw-r--r-- | packages/integrations/preact/src/index.ts | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/packages/integrations/preact/src/index.ts b/packages/integrations/preact/src/index.ts index 4f4b0ee79..98a2dd205 100644 --- a/packages/integrations/preact/src/index.ts +++ b/packages/integrations/preact/src/index.ts @@ -7,10 +7,9 @@ function getRenderer(development: boolean): AstroRenderer { serverEntrypoint: '@astrojs/preact/server.js', jsxImportSource: 'preact', jsxTransformOptions: async () => { - const { - default: { default: jsx }, - // @ts-expect-error types not found - } = await import('@babel/plugin-transform-react-jsx'); + // @ts-expect-error types not found + const plugin = await import('@babel/plugin-transform-react-jsx'); + const jsx = plugin.default?.default ?? plugin.default; return { plugins: [jsx({}, { runtime: 'automatic', importSource: 'preact' })], }; @@ -25,10 +24,9 @@ function getCompatRenderer(development: boolean): AstroRenderer { serverEntrypoint: '@astrojs/preact/server.js', jsxImportSource: 'react', jsxTransformOptions: async () => { - const { - default: { default: jsx }, - // @ts-expect-error types not found - } = await import('@babel/plugin-transform-react-jsx'); + // @ts-expect-error types not found + const plugin = await import('@babel/plugin-transform-react-jsx'); + const jsx = plugin.default?.default ?? plugin.default; return { plugins: [ jsx({}, { runtime: 'automatic', importSource: 'preact/compat' }), |