summaryrefslogtreecommitdiff
path: root/packages/integrations/preact/src
diff options
context:
space:
mode:
authorGravatar Houston (Bot) <108291165+astrobot-houston@users.noreply.github.com> 2023-08-11 08:14:20 -0700
committerGravatar GitHub <noreply@github.com> 2023-08-11 11:14:20 -0400
commit40efae65501fc79c281e34b5af912bf837b7105b (patch)
tree8a6b834647f9e6b2b36aceaaf47397cba8ac51e7 /packages/integrations/preact/src
parent866ed4098edffb052239cdb26e076cf8db61b1d9 (diff)
downloadastro-40efae65501fc79c281e34b5af912bf837b7105b.tar.gz
astro-40efae65501fc79c281e34b5af912bf837b7105b.tar.zst
astro-40efae65501fc79c281e34b5af912bf837b7105b.zip
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Diffstat (limited to 'packages/integrations/preact/src')
-rw-r--r--packages/integrations/preact/src/index.ts20
1 files changed, 9 insertions, 11 deletions
diff --git a/packages/integrations/preact/src/index.ts b/packages/integrations/preact/src/index.ts
index 153b9e1c3..9551f97eb 100644
--- a/packages/integrations/preact/src/index.ts
+++ b/packages/integrations/preact/src/index.ts
@@ -1,5 +1,5 @@
import type { AstroIntegration, AstroRenderer, ViteUserConfig } from 'astro';
-import preact, {type PreactPluginOptions as VitePreactPluginOptions} from '@preact/preset-vite';
+import preact, { type PreactPluginOptions as VitePreactPluginOptions } from '@preact/preset-vite';
import { fileURLToPath } from 'node:url';
const babelCwd = new URL('../', import.meta.url);
@@ -12,9 +12,9 @@ function getRenderer(development: boolean): AstroRenderer {
};
}
-export type Options =Pick<VitePreactPluginOptions, 'include' | 'exclude'> & { compat?: boolean };
+export type Options = Pick<VitePreactPluginOptions, 'include' | 'exclude'> & { compat?: boolean };
-export default function ({include, exclude, compat}: Options = {}): AstroIntegration {
+export default function ({ include, exclude, compat }: Options = {}): AstroIntegration {
return {
name: '@astrojs/preact',
hooks: {
@@ -23,8 +23,8 @@ export default function ({include, exclude, compat}: Options = {}): AstroIntegra
include,
exclude,
babel: {
- cwd: fileURLToPath(babelCwd)
- }
+ cwd: fileURLToPath(babelCwd),
+ },
});
const viteConfig: ViteUserConfig = {
@@ -35,8 +35,8 @@ export default function ({include, exclude, compat}: Options = {}): AstroIntegra
};
// If not compat, delete the plugin that does it
- if(!compat) {
- const pIndex = preactPlugin.findIndex(p => p.name == 'preact:config');
+ if (!compat) {
+ const pIndex = preactPlugin.findIndex((p) => p.name == 'preact:config');
if (pIndex >= 0) {
preactPlugin.splice(pIndex, 1);
}
@@ -44,12 +44,10 @@ export default function ({include, exclude, compat}: Options = {}): AstroIntegra
viteConfig.optimizeDeps!.include!.push(
'preact/compat',
'preact/test-utils',
- 'preact/compat/jsx-runtime',
+ 'preact/compat/jsx-runtime'
);
viteConfig.resolve = {
- alias: [
- { find: 'react/jsx-runtime', replacement: 'preact/jsx-runtime' },
- ],
+ alias: [{ find: 'react/jsx-runtime', replacement: 'preact/jsx-runtime' }],
dedupe: ['preact/compat', 'preact'],
};
// noExternal React entrypoints to be bundled, resolved, and aliased by Vite