angular-instantsearch: Error when flattening the source-map of angular-instantsearch with ngcc (angular 9)

Describe the bug 🐛

We are currently trying to update our angular to the angular 9.0.5 version.

However, it looks like angular 9 is not able to compile the lib angular-instantsearch. Here are the logs:

❯ npx ngcc
Warning: Entry point 'angular-instantsearch' contains deep imports into './node_m
odules/algoliasearch/lite', './node_modules/instantsearch.js/es', './node_modules/instantsearch.js/es/connectors', './ngx-web/node_modules/a
lgoliasearch/index', './node_modules/querystring-es3/encode'. This is probably no
t a problem, but may cause the compilation of entry points to be out of order.
Compiling angular-instantsearch : fesm5 as esm5
Compiling angular-instantsearch : esm2015 as esm2015
Compiling angular-instantsearch : fesm2015 as esm2015
Compiling angular-instantsearch : esm5 as esm5
Compiling angular-instantsearch : main as umd
Error: Error when flattening the source-map "./node_modules/angular-instantsearch
/bundles/angular-instantsearch.umd.js.map" for "./node_modules/angular-instantsea
rch/bundles/angular-instantsearch.umd.js": TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received null

To Reproduce 🔍

Steps to reproduce the behavior:

npx @angular/cli@9.0.5 new project
cd project
npm i --save angular-instantsearch@latest
npx ngcc

Expected behavior 💭

The build pass.

Environment:

  • OS: Mac OS Sierra
  • Version: angular-instantsearch 2.3.0, angular 9.0.5

About this issue

  • Original URL
  • State: open
  • Created 4 years ago
  • Comments: 28 (13 by maintainers)

Most upvoted comments

I don’t think you’re correctly following the steps mentioned: git clone https://github.com/doliG/ais-bug && cd ais-bug && npm i

My complete log is here: https://hastebin.com/elotuboguz.coffeescript

On line 134:

Error: Error when flattening the source-map "/tmp/ais-bug/node_modules/angular-instantsearch/bundles/angular-instantsearch.umd.js.map" for "/tmp/ais-bug/node_modules/angular-instantsearch/bundles/angular-instantsearch.umd.js": TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received null

I think you’ve missed the error because npm/yarn still output things after error’ing. Re-running ngcc will not throw an error though, and that’s why you didn’t see it.

I have tried with Angular 13 and it seems to work. I’ve tried:

npx @angular/cli@13.0.0 new project
cd project
npm i --save angular-instantsearch@latest
npx ngcc

Ant result is:

Warning: Entry point 'angular-instantsearch' contains deep imports into '/private/tmp/project/node_modules/instantsearch.js/es/connectors', '/private/tmp/project/node_modules/instantsearch.js/es/widgets/index/index', '/private/tmp/project/node_modules/querystring-es3/encode', '/private/tmp/project/node_modules/instantsearch.js/es/types', '/private/tmp/project/node_modules/instantsearch.js/es/connectors/breadcrumb/connectBreadcrumb', '/private/tmp/project/node_modules/instantsearch.js/es/connectors/clear-refinements/connectClearRefinements', '/private/tmp/project/node_modules/instantsearch.js/es/connectors/configure-related-items/connectConfigureRelatedItems', '/private/tmp/project/node_modules/instantsearch.js/es/connectors/configure/connectConfigure', '/private/tmp/project/node_modules/instantsearch.js/es/connectors/current-refinements/connectCurrentRefinements', '/private/tmp/project/node_modules/instantsearch.js/es/connectors/hierarchical-menu/connectHierarchicalMenu', '/private/tmp/project/node_modules/instantsearch.js/es/connectors/hits-per-page/connectHitsPerPage', '/private/tmp/project/node_modules/instantsearch.js/es/connectors/hits/connectHits', '/private/tmp/project/node_modules/instantsearch.js/es/connectors/infinite-hits/connectInfiniteHits', '/private/tmp/project/node_modules/instantsearch.js/es/connectors/menu/connectMenu', '/private/tmp/project/node_modules/instantsearch.js/es/connectors/numeric-menu/connectNumericMenu', '/private/tmp/project/node_modules/instantsearch.js/es/connectors/pagination/connectPagination', '/private/tmp/project/node_modules/instantsearch.js/es/connectors/query-rules/connectQueryRules', '/private/tmp/project/node_modules/instantsearch.js/es/connectors/range/connectRange', '/private/tmp/project/node_modules/instantsearch.js/es/connectors/rating-menu/connectRatingMenu', '/private/tmp/project/node_modules/instantsearch.js/es/connectors/refinement-list/connectRefinementList', '/private/tmp/project/node_modules/instantsearch.js/es/connectors/search-box/connectSearchBox', '/private/tmp/project/node_modules/instantsearch.js/es/connectors/sort-by/connectSortBy', '/private/tmp/project/node_modules/instantsearch.js/es/connectors/stats/connectStats', '/private/tmp/project/node_modules/instantsearch.js/es/connectors/toggle-refinement/connectToggleRefinement', '/private/tmp/project/node_modules/instantsearch.js/es/connectors/voice-search/connectVoiceSearch'. This is probably not a problem, but may cause the compilation of entry points to be out of order.

Can this warning cause some problems? I have an Angular 13 application, with this dependency, and it’s throwing a JIT compiler unavailableerror that I’m not sure whether is related to this warning.

Sorry @doliG, I haven’t yet found time for looking at this issue, I’ll put it first on my todo for tomorrow 😃