summaryrefslogtreecommitdiff
path: root/packages/integrations/preact/src
diff options
context:
space:
mode:
authorGravatar dave caruso <me@paperdave.net> 2023-08-09 12:11:41 -0700
committerGravatar GitHub <noreply@github.com> 2023-08-09 14:11:41 -0500
commit58b121d42a9f58a5a992f0c378b036f37e9715fc (patch)
tree3ea76e48c5e4777c22af5fe417fd91468bd548a5 /packages/integrations/preact/src
parente65b5b54950978957b75873ad4f493b3be26f3ea (diff)
downloadastro-58b121d42a9f58a5a992f0c378b036f37e9715fc.tar.gz
astro-58b121d42a9f58a5a992f0c378b036f37e9715fc.tar.zst
astro-58b121d42a9f58a5a992f0c378b036f37e9715fc.zip
Support Bun by adjusting how `@babel/plugin-transform-react-jsx` is imported. (#8007)
* Support bun/other tooling that respects `__esModule` * Add changeset file
Diffstat (limited to 'packages/integrations/preact/src')
-rw-r--r--packages/integrations/preact/src/index.ts14
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' }),