FlorianREGAZ / Python-Tls-Client

Advanced HTTP Library

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Can't find STATUS_CODES

ishandutta2007 opened this issue · comments

package.json:

{
  "dependencies": {
    ....
    "tls-client": "^0.0.5",
  }
}

npm -v

9.6.5

node -v

v16.17.1

I am on macOS 10.13.6

I am trying to build project npm run build

"STATUS_CODES" is not exported by "__vite-browser-external", imported by "node_modules/tls-client/dist/esm/response.js".
file: /Users/ishandutta2007/Documents/Projects/GrandGPT/node_modules/tls-client/dist/esm/response.js:2:9
1: import { TLSClientException } from "./exceptions";
2: import { STATUS_CODES } from "http";
            ^
3: class Response {
4:     url;
error during build:
RollupError: "STATUS_CODES" is not exported by "__vite-browser-external", imported by "node_modules/tls-client/dist/esm/response.js".

tried this didnt work

well this worked . https://stackoverflow.com/a/70666018/865220
We have to add this to vie.config.ts:

  resolve: {
    alias: {
      http: 'rollup-plugin-node-polyfills/polyfills/http',
    }
  }