diff options
author | 2022-08-10 22:22:10 +0800 | |
---|---|---|
committer | 2022-08-10 22:22:10 +0800 | |
commit | f8e3853394c2f2f48fac4b5eb2284e1960e59a13 (patch) | |
tree | a7ffda72cd7c1d45f5a92b7e12305d18d5b09829 /packages/integrations/preact/src | |
parent | c38e7f1890ba5bc97ddacee91ea196bcfc7652e6 (diff) | |
download | astro-f8e3853394c2f2f48fac4b5eb2284e1960e59a13.tar.gz astro-f8e3853394c2f2f48fac4b5eb2284e1960e59a13.tar.zst astro-f8e3853394c2f2f48fac4b5eb2284e1960e59a13.zip |
Fix preact compat support for libraries (#4213)
Co-authored-by: Matthew Phillips <matthew@skypack.dev>
Diffstat (limited to 'packages/integrations/preact/src')
-rw-r--r-- | packages/integrations/preact/src/index.ts | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/packages/integrations/preact/src/index.ts b/packages/integrations/preact/src/index.ts index 67a972475..5c5ed0363 100644 --- a/packages/integrations/preact/src/index.ts +++ b/packages/integrations/preact/src/index.ts @@ -78,8 +78,15 @@ function getViteConfiguration(compat?: boolean): ViteUserConfig { { find: 'react-dom', replacement: 'preact/compat' }, { find: 'react/jsx-runtime', replacement: 'preact/jsx-runtime' }, ], - dedupe: ['preact/compat'], + dedupe: ['preact/compat', 'preact'], }; + // noExternal React entrypoints to be bundled, resolved, and aliased by Vite + viteConfig.ssr!.noExternal = [ + 'react', + 'react-dom', + 'react-dom/test-utils', + 'react/jsx-runtime', + ]; } return viteConfig; |