Skip to content
This repository has been archived by the owner on Jun 11, 2021. It is now read-only.

Commit

Permalink
fix(docsearch): use Preact alias in Babel config
Browse files Browse the repository at this point in the history
  • Loading branch information
francoischalifour committed Jul 21, 2020
1 parent 9fa7d30 commit 31b3bd4
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 20 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
"@babel/preset-env": "7.10.2",
"@babel/preset-typescript": "7.10.1",
"@percy/cypress": "2.3.1",
"@rollup/plugin-alias": "3.1.1",
"@rollup/plugin-json": "4.0.2",
"@rollup/plugin-node-resolve": "7.1.1",
"@rollup/plugin-replace": "2.3.1",
Expand All @@ -63,6 +62,7 @@
"babel-loader": "8.0.6",
"babel-plugin-inline-json": "1.2.2",
"babel-plugin-inline-replace-variables": "1.3.1",
"babel-plugin-module-resolver": "4.0.0",
"bundlesize": "0.18.0",
"chokidar-cli": "2.1.0",
"concurrently": "5.1.0",
Expand Down
14 changes: 13 additions & 1 deletion packages/docsearch-js/babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
},
},
],
],
};
};
12 changes: 1 addition & 11 deletions packages/docsearch-js/rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import json from '@rollup/plugin-json';
import alias from '@rollup/plugin-alias';

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

Expand All @@ -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],
};
36 changes: 29 additions & 7 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3781,13 +3781,6 @@
prop-types "^15.6.1"
react-lifecycles-compat "^3.0.4"

"@rollup/[email protected]":
version "3.1.1"
resolved "https://registry.yarnpkg.com/@rollup/plugin-alias/-/plugin-alias-3.1.1.tgz#bb96cf37fefeb0a953a6566c284855c7d1cd290c"
integrity sha512-hNcQY4bpBUIvxekd26DBPgF7BT4mKVNDF5tBG4Zi+3IgwLxGYRY0itHs9D0oLVwXM5pvJDWJlBQro+au8WaUWw==
dependencies:
slash "^3.0.0"

"@rollup/[email protected]":
version "4.0.2"
resolved "https://registry.yarnpkg.com/@rollup/plugin-json/-/plugin-json-4.0.2.tgz#482185ee36ac7dd21c346e2dbcc22ffed0c6f2d6"
Expand Down Expand Up @@ -5976,6 +5969,17 @@ babel-plugin-minify-type-constructors@^0.4.3:
dependencies:
babel-helper-is-void-0 "^0.4.3"

[email protected]:
version "4.0.0"
resolved "https://registry.yarnpkg.com/babel-plugin-module-resolver/-/babel-plugin-module-resolver-4.0.0.tgz#8f3a3d9d48287dc1d3b0d5595113adabd36a847f"
integrity sha512-3pdEq3PXALilSJ6dnC4wMWr0AZixHRM4utpdpBR9g5QG7B7JwWyukQv7a9hVxkbGFl+nQbrHDqqQOIBtTXTP/Q==
dependencies:
find-babel-config "^1.2.0"
glob "^7.1.6"
pkg-up "^3.1.0"
reselect "^4.0.0"
resolve "^1.13.1"

babel-plugin-syntax-jsx@^6.18.0:
version "6.18.0"
resolved "https://registry.yarnpkg.com/babel-plugin-syntax-jsx/-/babel-plugin-syntax-jsx-6.18.0.tgz#0af32a9a6e13ca7a3fd5069e62d7b0f58d0d8946"
Expand Down Expand Up @@ -9768,6 +9772,14 @@ finalhandler@~1.1.2:
statuses "~1.5.0"
unpipe "~1.0.0"

find-babel-config@^1.2.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/find-babel-config/-/find-babel-config-1.2.0.tgz#a9b7b317eb5b9860cda9d54740a8c8337a2283a2"
integrity sha512-jB2CHJeqy6a820ssiqwrKMeyC6nNdmrcgkKWJWmpoxpE8RKciYJXCcXRq1h2AzCo5I5BJeN2tkGEO3hLTuePRA==
dependencies:
json5 "^0.5.1"
path-exists "^3.0.0"

find-cache-dir@^2.0.0, find-cache-dir@^2.1.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/find-cache-dir/-/find-cache-dir-2.1.0.tgz#8d0f94cd13fe43c6c7c261a0d86115ca918c05f7"
Expand Down Expand Up @@ -12484,6 +12496,11 @@ json3@^3.3.2:
resolved "https://registry.yarnpkg.com/json3/-/json3-3.3.3.tgz#7fc10e375fc5ae42c4705a5cc0aa6f62be305b81"
integrity sha512-c7/8mbUsKigAbLkD5B010BK4D9LZm7A1pNItkEwiUZRpIN66exu/e7YQWysGun+TRKaJp8MhemM+VkfWv42aCA==

json5@^0.5.1:
version "0.5.1"
resolved "https://registry.yarnpkg.com/json5/-/json5-0.5.1.tgz#1eade7acc012034ad84e2396767ead9fa5495821"
integrity sha1-Hq3nrMASA0rYTiOWdn6tn6VJWCE=

json5@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/json5/-/json5-1.0.1.tgz#779fb0018604fa854eacbf6252180d83543e3dbe"
Expand Down Expand Up @@ -17140,6 +17157,11 @@ requires-port@^1.0.0:
resolved "https://registry.yarnpkg.com/requires-port/-/requires-port-1.0.0.tgz#925d2601d39ac485e091cf0da5c6e694dc3dcaff"
integrity sha1-kl0mAdOaxIXgkc8NpcbmlNw9yv8=

reselect@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/reselect/-/reselect-4.0.0.tgz#f2529830e5d3d0e021408b246a206ef4ea4437f7"
integrity sha512-qUgANli03jjAyGlnbYVAV5vvnOmJnODyABz51RdBN7M4WaVu8mecZWgyQNkG8Yqe3KRGRt0l4K4B3XVEULC4CA==

resize-observer-polyfill@^1.5.1:
version "1.5.1"
resolved "https://registry.yarnpkg.com/resize-observer-polyfill/-/resize-observer-polyfill-1.5.1.tgz#0e9020dd3d21024458d4ebd27e23e40269810464"
Expand Down

0 comments on commit 31b3bd4

Please sign in to comment.