nuxt-modules / algolia

🔎 Algolia module for Nuxt
https://algolia.nuxtjs.org/
MIT License
189 stars 35 forks source link

Can't build project with v1.5.1 – Agent is not exported #142

Closed michaelvcolianna closed 1 year ago

michaelvcolianna commented 1 year ago

Version

@nuxtjs/algolia: v1.5.1 nuxt: v3.0.0

Reproduction Link

https://stackblitz.com/github/michaelvcolianna/chegg-algolia-test

Steps to reproduce

Created a page using the "client side" example in the documentation. At first, used the API key & app ID of my index, then reverted to using the test keys provided in the documentation. This worked in dev mode. Pushed sample page and Netlify build failed. Confirmed building also fails locally and on StackBlitz.

Attempted the fix outlined in https://github.com/nuxt-modules/algolia/issues/119#issuecomment-1384190558 but that also did not change the result.

What is Expected?

Project will build.

What is actually happening?

Building (both build and generate commands) results in an error:

ERROR  'Agent' is not exported by __vite-browser-external, imported by node_modules/@algolia/requester-node-http/dist/requester-node-http.esm.js
file: /home/projects/nbwiznlol.github/node_modules/@algolia/requester-node-http/dist/requester-node-http.esm.js:2:9
1: import * as http from 'http';
2: import { Agent } from 'http';
            ^
3: import * as https from 'https';
4: import { Agent as Agent$1 } from 'https';

 ERROR  'Agent' is not exported by __vite-browser-external, imported by node_modules/@algolia/requester-node-http/dist/requester-node-http.esm.js

Please let me know if I can provide any further information.

Baroshem commented 1 year ago

I can confirm that on version 3.0.0 of Nuxt this does not work.

I tested the newer versions of nuxt and there it works correctly.

Can you upgrade core nuxt package?

michaelvcolianna commented 1 year ago

Ah, apologies if that was something I missed in the prior ticket!

Yes updating to latest Nuxt allows the project to build. Whether that breaks any other things remains to be seen (and isn't relevant anyway) but for purposes of the reported issue, Nuxt v3.3.2 works as intended without the Agent is not exported error.

Thanks!

Baroshem commented 1 year ago

Awesome,

I believe that there was some change in the newer version of the core Nuxt that was making it fail.

Glad that it works right now :)

If you will have any other issues, do not hesitate to create an issue :)