Kong / Kong/httpsnippet

does not work with vite

Open
#329 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
1.2k
Forks
242
PR merge metrics
No merged PRs in 30d

Description

It throws error as `global is not defined`
```txt
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

Contributor guide

Open the contributing guide

Research direction

Start by tracing the event-stream dependency shown in the stack trace and its import from httpsnippet/src/index.js under a Vite browser build. Confirm the failure with the reported Vite 4.4.9 setup; done means the package builds and runs in the browser without the global-is-not-defined error.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript, vite
Domain
build-system, frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.