[ci] format

This commit is contained in:
delucis 2022-06-29 15:48:55 +00:00 committed by fredkbot
parent e3fdc9b403
commit e667477103

View file

@ -32,14 +32,17 @@ function getCompatRenderer(): AstroRenderer {
return {
plugins: [
jsx({}, { runtime: 'automatic', importSource: 'preact/compat' }),
['babel-plugin-module-resolver', {
alias: {
'react': 'preact/compat',
'react-dom/test-utils': 'preact/test-utils',
'react-dom': 'preact/compat',
'react/jsx-runtime': 'preact/jsx-runtime'
}
}],
[
'babel-plugin-module-resolver',
{
alias: {
react: 'preact/compat',
'react-dom/test-utils': 'preact/test-utils',
'react-dom': 'preact/compat',
'react/jsx-runtime': 'preact/jsx-runtime',
},
},
],
],
};
},
@ -61,25 +64,25 @@ function getViteConfiguration(compat?: boolean): ViteUserConfig {
external: ['preact-render-to-string'],
},
};
if (compat) {
viteConfig.optimizeDeps!.include!.push(
viteConfig.optimizeDeps!.include!.push(
'preact/compat',
'preact/test-utils',
'preact/compat/jsx-runtime',
'preact/compat/jsx-runtime'
);
viteConfig.resolve = {
alias: [
viteConfig.resolve = {
alias: [
{ find: 'react', replacement: 'preact/compat' },
{ find: 'react-dom/test-utils', replacement: 'preact/test-utils' },
{ find: 'react-dom', replacement: 'preact/compat' },
{ find: 'react/jsx-runtime', replacement: 'preact/jsx-runtime' }
],
dedupe: ['preact/compat'],
};
}
return viteConfig
{ find: 'react-dom/test-utils', replacement: 'preact/test-utils' },
{ find: 'react-dom', replacement: 'preact/compat' },
{ find: 'react/jsx-runtime', replacement: 'preact/jsx-runtime' },
],
dedupe: ['preact/compat'],
};
}
return viteConfig;
}
export default function ({ compat }: { compat?: boolean } = {}): AstroIntegration {