From 8ccc2ce36e5f6e0bbb6c12d2d0e6121e301e81d3 Mon Sep 17 00:00:00 2001 From: CaoMeiYouRen <996881204@qq.com> Date: Sun, 12 Mar 2023 19:55:11 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=20=E6=96=B0=E7=89=88?= =?UTF-8?q?=E6=9C=AC=E7=9A=84=E4=BE=9D=E8=B5=96=E5=92=8C=E7=B1=BB=E5=9E=8B?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .npmrc | 1 + package.json | 8 ++++---- src/utils/ajax.ts | 5 +++-- 3 files changed, 8 insertions(+), 6 deletions(-) create mode 100644 .npmrc diff --git a/.npmrc b/.npmrc new file mode 100644 index 0000000..319e41e --- /dev/null +++ b/.npmrc @@ -0,0 +1 @@ +strict-peer-dependencies=false diff --git a/package.json b/package.json index 05aac11..4fde13b 100644 --- a/package.json +++ b/package.json @@ -35,7 +35,7 @@ "build": "cross-env NODE_ENV=production rollup -c", "postbuild": "npm run build:type", "build:type": "api-extractor run", - "postbuild:type": "rimraf \"dist/**/!(*.js?(.map)|index.d.ts)\"", + "postbuild:type": "rimraf \"dist/**/!(*.?(c|m)js?(.map)|index.d.ts)\" --glob", "analyzer": "cross-env NODE_ENV=production ANALYZER=true rollup -c", "dev": "cross-env NODE_ENV=development ts-node-dev src/index.ts", "dev:rollup": "cross-env NODE_ENV=development rollup -c", @@ -82,8 +82,8 @@ "lodash": "^4.17.21", "mocha": "^10.0.0", "module-alias": "^2.2.2", - "rimraf": "^4.0.4", - "rollup": "^2.67.2", + "rimraf": "^4.4.0", + "rollup": "^2.79.1", "rollup-plugin-analyzer": "^4.0.0", "rollup-plugin-terser": "^7.0.2", "semantic-release": "^20.0.2", @@ -124,4 +124,4 @@ "git add" ] } -} +} \ No newline at end of file diff --git a/src/utils/ajax.ts b/src/utils/ajax.ts index 52ec149..10e5e69 100644 --- a/src/utils/ajax.ts +++ b/src/utils/ajax.ts @@ -9,7 +9,7 @@ interface AjaxConfig { query?: Record data?: Record | string | Buffer | ArrayBuffer method?: Method - headers?: AxiosRequestHeaders + headers?: Record baseURL?: string } @@ -25,7 +25,8 @@ interface AjaxConfig { export async function ajax(config: AjaxConfig): Promise> { try { Debugger('ajax config: %O', config) - const { url, query = {}, method = 'GET', headers = {}, baseURL = '' } = config + const { url, query = {}, method = 'GET', baseURL = '' } = config + const headers = (config.headers || {}) as AxiosRequestHeaders let { data = {} } = config if (headers['Content-Type'] === 'application/x-www-form-urlencoded' && typeof data === 'object') {