1. Anuncie Aqui ! Entre em contato fdantas@4each.com.br

Angular 18/algoliasearch 5 appID is missing only on production build using algoliasearch/lite

Discussão em 'Angular' iniciado por Larry King, Setembro 28, 2024 às 12:43.

  1. Larry King

    Larry King Guest

    I have just upgraded algoliasearch in an Angular 18 app from version 4 to 5. Here are the pertinent imports:

    import { ALGOLIA_APP_ID, ALGOLIA_API_KEY, ALGOLIA_UNIT } from '@env';
    import { liteClient, LiteClient } from 'algoliasearch/lite';


    and client initialization:

    this.searchClient = liteClient(ALGOLIA_APP_ID, ALGOLIA_API_KEY);


    This works well when running this code in dev mode. However when running this in production mode I get appId is missing error. Most assuredly ALGOLIA_APP_ID is provided and is of type string in both cases.

    Now if I replace algoliasearch/lite with algoliasearch as such:

    import { algoliasearch, SearchClient } from 'algoliasearch';

    this.searchClient = algoliasearch(ALGOLIA_APP_ID, ALGOLIA_API_KEY);


    this works in both dev and production builds.

    The algoliasearch/lite node_module files are javascript and algoliasearch are typescript, and there appear to be no bugs in the code.

    How can I get algoliasearch/lite working in production builds?

    Continue reading...

Compartilhe esta Página