Kong / httpsnippet

HTTP Request snippet generator for many languages & libraries
Apache License 2.0
1.15k stars 227 forks source link

does not work with vite #329

Open ayZagen opened 1 year ago

ayZagen commented 1 year ago

It throws error as global is not defined

Error: global is not defined
at node_modules/.pnpm/event-stream@3.3.4/node_modules/event-stream/index.js (http://localhost:3000/_nuxt/node_modules/.cache/vite/client/deps/httpsnippet_src_index.js?v=8be32947:2722:23)
at __require (http://localhost:3000/_nuxt/node_modules/.cache/vite/client/deps/chunk-5WWUZCGV.js?v=8be32947:8:50)
at node_modules/.pnpm/httpsnippet@2.0.0_mkdirp@1.0.4/node_modules/httpsnippet/src/index.js (http://localhost:3000/_nuxt/node_modules/.cache/vite/client/deps/httpsnippet_src_index.js?v=8be32947:10392:14)
at __require (http://localhost:3000/_nuxt/node_modules/.cache/vite/client/deps/chunk-5WWUZCGV.js?v=8be32947:8:50)
at http://localhost:3000/_nuxt/node_modules/.cache/vite/client/deps/httpsnippet_src_index.js?v=8be32947:10614:16

which is because of the library event-stream is not a browser compatible lib?

Using version: 3.0.1 vite: 4.4.9

brianvoe commented 1 year ago

Its a node package that cant be used in from end development unless you figure out a bunch of polyfills

tnrich commented 1 week ago

@ayZagen looks like someone made this version work for the client - https://www.npmjs.com/package/httpsnippet-lite

(vite compatible)

brianvoe commented 1 week ago

OMG! you just made my night ive been running a server to make http calls to get http responses

brianvoe commented 1 week ago

@tnrich @ayZagen https://github.com/Kong/httpsnippet/pull/359 Go over there comment to get this in!