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
2021-12-22 16:11:05 -05:00

31 lines
754 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'],
},
};
},
};