astro/packages/renderers/renderer-preact/index.js
Drew Powers 330620e1b3 Update renderer API for Vite (#1623)
* Update renderer API for Vite

* Fix lit-element tests

* Clean up comments

* Throw friendly error if renderer provides viteConfig in a bad format
2021-10-22 16:25:38 -06:00

24 lines
635 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'],
},
ssr: {
external: ['preact-render-to-string'],
},
};
},
};