fix: ESM error (#826)
This commit is contained in:
parent
9081b22ce9
commit
57a1d6e3cd
|
@ -16,7 +16,7 @@
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "esno ./src/index.ts",
|
"start": "esno ./src/index.ts",
|
||||||
"dev": "esno watch ./src/index.ts",
|
"dev": "esno watch ./src/index.ts",
|
||||||
"prod": "esno ./build/index.js",
|
"prod": "node ./build/index.mjs",
|
||||||
"build": "pnpm clean && tsup",
|
"build": "pnpm clean && tsup",
|
||||||
"clean": "rimraf build",
|
"clean": "rimraf build",
|
||||||
"lint": "eslint .",
|
"lint": "eslint .",
|
||||||
|
|
|
@ -3,7 +3,7 @@ import 'isomorphic-fetch'
|
||||||
import type { ChatGPTAPIOptions, ChatMessage, SendMessageOptions } from 'chatgpt'
|
import type { ChatGPTAPIOptions, ChatMessage, SendMessageOptions } from 'chatgpt'
|
||||||
import { ChatGPTAPI, ChatGPTUnofficialProxyAPI } from 'chatgpt'
|
import { ChatGPTAPI, ChatGPTUnofficialProxyAPI } from 'chatgpt'
|
||||||
import { SocksProxyAgent } from 'socks-proxy-agent'
|
import { SocksProxyAgent } from 'socks-proxy-agent'
|
||||||
import { HttpsProxyAgent } from 'https-proxy-agent'
|
import httpsProxyAgent from 'https-proxy-agent'
|
||||||
import fetch from 'node-fetch'
|
import fetch from 'node-fetch'
|
||||||
import axios from 'axios'
|
import axios from 'axios'
|
||||||
import { sendResponse } from '../utils'
|
import { sendResponse } from '../utils'
|
||||||
|
@ -11,6 +11,8 @@ import { isNotEmptyString } from '../utils/is'
|
||||||
import type { ApiModel, ChatContext, ChatGPTUnofficialProxyAPIOptions, ModelConfig } from '../types'
|
import type { ApiModel, ChatContext, ChatGPTUnofficialProxyAPIOptions, ModelConfig } from '../types'
|
||||||
import type { RequestOptions } from './types'
|
import type { RequestOptions } from './types'
|
||||||
|
|
||||||
|
const { HttpsProxyAgent } = httpsProxyAgent
|
||||||
|
|
||||||
dotenv.config()
|
dotenv.config()
|
||||||
|
|
||||||
const ErrorCodeMessage: Record<string, string> = {
|
const ErrorCodeMessage: Record<string, string> = {
|
||||||
|
|
|
@ -4,7 +4,7 @@ export default defineConfig({
|
||||||
entry: ['src/index.ts'],
|
entry: ['src/index.ts'],
|
||||||
outDir: 'build',
|
outDir: 'build',
|
||||||
target: 'es2020',
|
target: 'es2020',
|
||||||
format: ['cjs'],
|
format: ['esm'],
|
||||||
splitting: false,
|
splitting: false,
|
||||||
sourcemap: true,
|
sourcemap: true,
|
||||||
minify: false,
|
minify: false,
|
||||||
|
|
Loading…
Reference in New Issue