[ci] format
This commit is contained in:
parent
e3fdc9b403
commit
e667477103
1 changed files with 25 additions and 22 deletions
|
@ -32,14 +32,17 @@ function getCompatRenderer(): AstroRenderer {
|
||||||
return {
|
return {
|
||||||
plugins: [
|
plugins: [
|
||||||
jsx({}, { runtime: 'automatic', importSource: 'preact/compat' }),
|
jsx({}, { runtime: 'automatic', importSource: 'preact/compat' }),
|
||||||
['babel-plugin-module-resolver', {
|
[
|
||||||
alias: {
|
'babel-plugin-module-resolver',
|
||||||
'react': 'preact/compat',
|
{
|
||||||
'react-dom/test-utils': 'preact/test-utils',
|
alias: {
|
||||||
'react-dom': 'preact/compat',
|
react: 'preact/compat',
|
||||||
'react/jsx-runtime': 'preact/jsx-runtime'
|
'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'],
|
external: ['preact-render-to-string'],
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
if (compat) {
|
if (compat) {
|
||||||
viteConfig.optimizeDeps!.include!.push(
|
viteConfig.optimizeDeps!.include!.push(
|
||||||
'preact/compat',
|
'preact/compat',
|
||||||
'preact/test-utils',
|
'preact/test-utils',
|
||||||
'preact/compat/jsx-runtime',
|
'preact/compat/jsx-runtime'
|
||||||
);
|
);
|
||||||
viteConfig.resolve = {
|
viteConfig.resolve = {
|
||||||
alias: [
|
alias: [
|
||||||
{ find: 'react', replacement: 'preact/compat' },
|
{ find: 'react', replacement: 'preact/compat' },
|
||||||
{ find: 'react-dom/test-utils', replacement: 'preact/test-utils' },
|
{ find: 'react-dom/test-utils', replacement: 'preact/test-utils' },
|
||||||
{ find: 'react-dom', replacement: 'preact/compat' },
|
{ find: 'react-dom', replacement: 'preact/compat' },
|
||||||
{ find: 'react/jsx-runtime', replacement: 'preact/jsx-runtime' }
|
{ find: 'react/jsx-runtime', replacement: 'preact/jsx-runtime' },
|
||||||
],
|
],
|
||||||
dedupe: ['preact/compat'],
|
dedupe: ['preact/compat'],
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
return viteConfig
|
return viteConfig;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function ({ compat }: { compat?: boolean } = {}): AstroIntegration {
|
export default function ({ compat }: { compat?: boolean } = {}): AstroIntegration {
|
||||||
|
|
Loading…
Reference in a new issue