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/index.js
2022-04-02 14:15:41 -06:00

30 lines
669 B
JavaScript

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