0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2024-12-23 21:53:55 -05:00
astro/packages/renderers/renderer-preact/compat/index.js
2022-04-02 14:15:41 -06:00

36 lines
781 B
JavaScript

export default {
name: '@astrojs/renderer-preact/compat',
client: '../client.js',
server: '../server.js',
jsxImportSource: 'react',
jsxTransformOptions: async () => {
const {
default: { default: jsx },
} = await import('@babel/plugin-transform-react-jsx');
return {
plugins: [jsx({}, { runtime: 'automatic', importSource: 'preact/compat' })],
};
},
viteConfig() {
return {
alias: {
react: 'preact/compat',
'react-dom': 'preact/compat',
},
resolve: {
dedupe: ['react', 'react-dom'],
},
optimizeDeps: {
include: [
'@astrojs/renderer-preact/client.js',
'preact/compat',
'preact/compat/jsx-runtime',
'preact-render-to-string',
],
},
ssr: {
external: ['preact-render-to-string'],
},
};
},
};