algolia / instantsearch

⚑️ Libraries for building performant and instant search experiences with Algolia. Compatible with JavaScript, TypeScript, React and Vue.

Home Page:https://www.algolia.com/doc/guides/building-search-ui/what-is-instantsearch/js/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Rollup build error after upgrade to 4.65.0

thumbtech opened this issue Β· comments

πŸ› Current behavior

After npm upgrade revved instantsearch.js from 4.64.2 to 4.65.0

Using:

import algoliasearch from 'algoliasearch/lite';
import instantsearch from 'instantsearch.js';
import { connectStats } from 'instantsearch.js/es/connectors';
import { searchBox, hits, stats, index } from 'instantsearch.js/es/widgets';

Build fails with error:

[vite]: Rollup failed to resolve import "@babel/runtime/helpers/extends" from "/home/forge/example.com/node_modules/instantsearch-ui-components/dist/es/components/Highlight.js".
This is most likely unintended because it can break your application at runtime.
If you do want to externalize this module explicitly add it to
`build.rollupOptions.external`
error during build:
Error: [vite]: Rollup failed to resolve import "@babel/runtime/helpers/extends" from "/home/forge/example.com/node_modules/instantsearch-ui-components/dist/es/components/Highlight.js".
This is most likely unintended because it can break your application at runtime.
If you do want to externalize this module explicitly add it to
`build.rollupOptions.external`
    at viteWarn (file:///home/forge/example.com/node_modules/vite/dist/node/chunks/dep-52909643.js:48216:27)
    at onRollupWarning (file:///home/forge/example.com/node_modules/vite/dist/node/chunks/dep-52909643.js:48248:9)
    at onwarn (file:///home/forge/example.com/node_modules/vite/dist/node/chunks/dep-52909643.js:47976:13)
    at file:///home/forge/example.com/node_modules/rollup/dist/es/shared/node-entry.js:24276:13
    at Object.logger [as onLog] (file:///home/forge/example.com/node_modules/rollup/dist/es/shared/node-entry.js:25950:9)
    at ModuleLoader.handleInvalidResolvedId (file:///home/forge/example.com/node_modules/rollup/dist/es/shared/node-entry.js:24862:26)
    at file:///home/forge/example.com/node_modules/rollup/dist/es/shared/node-entry.js:24822:26

πŸ” Steps to reproduce

npm run build

Live reproduction

server build

πŸ’­ Expected behavior

build success

Package version

instantsearch.js 4.65.0

Operating system

No response

Browser

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

That's odd, we're using rollup as well. I'd say it's likely related to b4ed187, but not sure

That's odd, we're using rollup as well. I'd say it's likely related to b4ed187, but not sure

Does that imply you are not receiving the error w/ 4.65.0 ? Do you use Highlight.js ?

FWIW I'm a Laravel (Vite/Rollup) dev & tried a fresh install (Docker) and the documented algolia/instantsearch.js install fails to build for me as above. If you are building successfully with Rollup I suppose there must be some discrepancy with build options?

Hi, I've been able to reproduce your issue in a barebone Parcel structure. We'll release a fix in the next version.

As a workaround in the meantime, does the error go away if you manually add @babel/runtime as a dev dependency?

As a workaround in the meantime, does the error go away if you manually add @babel/runtime as a dev dependency?

Yes it does build after npm install --save-dev @babel/runtime !

Thank you!

I'll just reopen it, as the PR isn't merged yet :)