Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,10 @@ module.exports = (api) => {
// we require polyfills for this already
'Array.prototype.includes',

// Used only in Chat, which expects modern browsers
'Object.fromEntries',
'Object.entries',

// false positive (babel doesn't know types)
// this is actually only called on arrays
'String.prototype.includes',
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@
"rollup-plugin-node-resolve": "5.2.0",
"rollup-plugin-replace": "2.2.0",
"rollup-plugin-uglify": "6.0.4",
"rollup-plugin-alias": "2.2.0",
"shelljs": "0.8.5",
"shipjs": "0.26.0",
"ts-jest": "27",
Expand Down
12 changes: 12 additions & 0 deletions packages/instantsearch.js/scripts/rollup/emptyModule.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// Placeholder export for 'eventsource-parser' module
export const EventSourceParserStream = {};

// Placeholder export for 'zod' module
export const ZodFirstPartyTypeKind = {};
export const z = {};
export const toJSONSchema = {};
export const safeParseAsync = {};

// Placeholder export for 'react' module
export const cloneElement = {};
export const createElement = {};
19 changes: 19 additions & 0 deletions packages/instantsearch.js/scripts/rollup/rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import path from 'path';

import alias from 'rollup-plugin-alias';
import babel from 'rollup-plugin-babel';
import commonjs from 'rollup-plugin-commonjs';
import filesize from 'rollup-plugin-filesize';
Expand All @@ -16,6 +19,22 @@ const link = 'https://github.com/algolia/instantsearch';
const license = `/*! InstantSearch.js ${version} | ${algolia} | ${link} */`;

const plugins = [
alias({
entries: [
{
find: /^zod.*/,
replacement: path.join(__dirname, './emptyModule.js'),
},
{
find: /^eventsource-parser.*/,
replacement: path.join(__dirname, './emptyModule.js'),
},
{
find: /^react.*/,
replacement: path.join(__dirname, './emptyModule.js'),
},
],
}),
resolve({
browser: true,
preferBuiltins: false,
Expand Down
4 changes: 2 additions & 2 deletions packages/instantsearch.js/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as connectors from './connectors/index.umd';
import * as connectors from './connectors/index';
import * as helpers from './helpers/index';
import { createInfiniteHitsSessionStorageCache } from './lib/infiniteHitsCache/index';
import InstantSearch from './lib/InstantSearch';
Expand All @@ -7,7 +7,7 @@ import * as stateMappings from './lib/stateMappings/index';
import version from './lib/version';
import * as middlewares from './middlewares/index';
import * as templates from './templates/index';
import * as widgets from './widgets/index.umd';
import * as widgets from './widgets/index';

import type { InstantSearchOptions } from './lib/InstantSearch';
import type { Expand, UiState } from './types';
Expand Down
9 changes: 8 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -26487,7 +26487,7 @@ [email protected]:
loose-envify "^1.1.0"
object-assign "^4.1.1"

"react@>= 0.14.0", react@19.0.0:
react@19.0.0, "react@>= 0.14.0":
version "19.0.0"
resolved "https://registry.yarnpkg.com/react/-/react-19.0.0.tgz#6e1969251b9f108870aa4bff37a0ce9ddfaaabdd"
integrity sha512-V8AVnmPIICiWpGfm6GLzCR/W5FXLchHop40W4nXBmdlEceh16rCN8O8LNWm5bh5XUX91fh7KpA+W0TgMKmgTpQ==
Expand Down Expand Up @@ -27522,6 +27522,13 @@ ripemd160@^2.0.0, ripemd160@^2.0.1:
hash-base "^2.0.0"
inherits "^2.0.1"

[email protected]:
version "2.2.0"
resolved "https://registry.yarnpkg.com/rollup-plugin-alias/-/rollup-plugin-alias-2.2.0.tgz#5004a2bc542a2eebb45b5a0fff8c6f540439decc"
integrity sha512-9ZK410qeFed4gGrHoojBpxLsHF74vPgsheGg9JRW5RbALAxqdvJbd357mSqWBqUrBfRVnZnNUXTZdYLxxQEA5A==
dependencies:
slash "^3.0.0"

[email protected]:
version "4.3.3"
resolved "https://registry.yarnpkg.com/rollup-plugin-babel/-/rollup-plugin-babel-4.3.3.tgz#7eb5ac16d9b5831c3fd5d97e8df77ba25c72a2aa"
Expand Down