From 4acf723becb8be4708cd5edd2b9ee675ff6d19c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Chalifour?= Date: Tue, 21 Jul 2020 10:29:47 +0200 Subject: [PATCH] fix(docsearch): use Preact alias in Babel config --- babel.config.js | 14 +++++++++++++- rollup.config.js | 12 +----------- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/babel.config.js b/babel.config.js index ec916c22..a614d94d 100644 --- a/babel.config.js +++ b/babel.config.js @@ -22,6 +22,18 @@ module.exports = (api) => { }, ], ], - plugins: [['@babel/plugin-transform-react-jsx']], + plugins: [ + ['@babel/plugin-transform-react-jsx'], + [ + 'module-resolver', + { + root: ['./src'], + alias: { + react: 'preact/compat', + 'react-dom': 'preact/compat', + }, + }, + ], + ], }; }; diff --git a/rollup.config.js b/rollup.config.js index e36fda13..05d3f3c9 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -1,5 +1,4 @@ import json from '@rollup/plugin-json'; -import alias from '@rollup/plugin-alias'; import { sharedPlugins } from '../autocomplete-core/rollup.config'; @@ -11,14 +10,5 @@ export default { sourcemap: true, name: 'docsearch', }, - plugins: [ - json(), - alias({ - entries: [ - { find: 'react', replacement: 'preact/compat' }, - { find: 'react-dom', replacement: 'preact/compat' }, - ], - }), - ...sharedPlugins, - ], + plugins: [json(), ...sharedPlugins], };