Skip to content

Commit 4acf723

Browse files
fix(docsearch): use Preact alias in Babel config
1 parent ba32314 commit 4acf723

2 files changed

Lines changed: 14 additions & 12 deletions

File tree

babel.config.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,18 @@ module.exports = (api) => {
2222
},
2323
],
2424
],
25-
plugins: [['@babel/plugin-transform-react-jsx']],
25+
plugins: [
26+
['@babel/plugin-transform-react-jsx'],
27+
[
28+
'module-resolver',
29+
{
30+
root: ['./src'],
31+
alias: {
32+
react: 'preact/compat',
33+
'react-dom': 'preact/compat',
34+
},
35+
},
36+
],
37+
],
2638
};
2739
};

rollup.config.js

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import json from '@rollup/plugin-json';
2-
import alias from '@rollup/plugin-alias';
32

43
import { sharedPlugins } from '../autocomplete-core/rollup.config';
54

@@ -11,14 +10,5 @@ export default {
1110
sourcemap: true,
1211
name: 'docsearch',
1312
},
14-
plugins: [
15-
json(),
16-
alias({
17-
entries: [
18-
{ find: 'react', replacement: 'preact/compat' },
19-
{ find: 'react-dom', replacement: 'preact/compat' },
20-
],
21-
}),
22-
...sharedPlugins,
23-
],
13+
plugins: [json(), ...sharedPlugins],
2414
};

0 commit comments

Comments
 (0)