summaryrefslogtreecommitdiff
path: root/packages/renderers/renderer-preact/index.js
blob: a1a21a56183ca46ec1ff8556031db6fa6af4797c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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'],
      },
    };
  },
};