Skip to content
This repository has been archived by the owner on Sep 5, 2024. It is now read-only.

[Bug] Angular InstantSearch component does not work with Angular CLI v6 #90

Closed
prabh-62 opened this issue Mar 1, 2018 · 9 comments
Closed
Assignees

Comments

@prabh-62
Copy link

prabh-62 commented Mar 1, 2018

I'm submitting a...

  • Bug report

Current behavior

Algolia InstantSearch Angular component does not work with Angular CLI v6

Expected behavior

Algolia InstantSearch Angular component should work with Angular CLI v6

Minimal reproduction of the problem with instructions

> ng version
	- Angular CLI: 6.0.0-beta.4
> ng new instantsearch-test
	- (Now setup Algolia InstantSearch component as described here: https://community.algolia.com/angular-instantsearch/getting-started.html)

> yarn start

Open Chrome browser and enable devtools. We receive an error "process is not defined" in Console
algolia

Apparently, there was a breaking change in Angular CLI - Read this Comment

Reference: angular/angular-cli#9827

Environment

Package versions:

Browser:

  • Chrome (desktop) version 64.0.3282.186

System:

  • TypeScript version: 2.6.2 (strict mode ON)
  • Node version: 8.9.4
  • Platform: Windows 10 Pro 1709
@iam4x
Copy link
Contributor

iam4x commented Mar 2, 2018

Hi @prabh-62

Thank you for your feedback, I'm not sure what to do here since the CLI v6 is still in beta and will change.

I'll wait for a RC before making changes to support the CLI v6. In the meantime I would recommend to stay with the v1.x

@iam4x iam4x self-assigned this Mar 2, 2018
@iam4x
Copy link
Contributor

iam4x commented Mar 2, 2018

And thank you to pointing me directly to the comment, this is the root cause about process not defined by the CLI anymore.

@mwawrusch
Copy link

!!process && .... should probably do the trick to fix this.

@Haroenv
Copy link
Contributor

Haroenv commented Mar 12, 2018

Yes, but the use of process here is in a downstream dependency. It would probably be best to add the serialising of process.env in your angular settings for now to make sure no error happens

@markudevelop
Copy link

This bug still exists and it's a problem

@markudevelop markudevelop mentioned this issue May 6, 2018
@Haroenv
Copy link
Contributor

Haroenv commented May 7, 2018

See algolia/algoliasearch-client-javascript#692 and algolia/algoliasearch-client-javascript#691. Could you try that out or give a reproducible project please?

@Haroenv
Copy link
Contributor

Haroenv commented May 7, 2018

My PR to the API client was insufficient due to some complications with our build process, but the workaround you can use in your app is adding this to polyfills.ts:

(window as any).process = {
  env: { DEBUG: undefined },
};

@markudevelop
Copy link

@Haroenv awesome this works that's good enough for me thanks!

@iam4x
Copy link
Contributor

iam4x commented May 30, 2018

Angular InstantSearch v2.0.0 is released, you can now use Angular v6.0.0 with the polyfill.ts workaround from @Haroenv

This is documented on the Getting started and Migration guide

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants