330620e1b3
* Update renderer API for Vite * Fix lit-element tests * Clean up comments * Throw friendly error if renderer provides viteConfig in a bad format
27 lines
702 B
JavaScript
27 lines
702 B
JavaScript
export default {
|
|
name: '@astrojs/renderer-react',
|
|
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: 'react' })],
|
|
};
|
|
},
|
|
viteConfig() {
|
|
return {
|
|
optimizeDeps: {
|
|
include: ['@astrojs/renderer-react/client.js', 'react', 'react/jsx-runtime', 'react/jsx-dev-runtime', 'react-dom'],
|
|
},
|
|
resolve: {
|
|
dedupe: ['react', 'react-dom'],
|
|
},
|
|
ssr: {
|
|
external: ['react-dom/server.js'],
|
|
},
|
|
};
|
|
},
|
|
};
|