From b5d5c67e3e7724bdf6f10a8c2d38bc0819e78f08 Mon Sep 17 00:00:00 2001 From: "ronggui.shu" Date: Wed, 12 Oct 2022 13:22:59 +0800 Subject: [PATCH 1/2] chore: add necessary devDependencies for rollup build --- package.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 0cda7a3def..94ace876af 100644 --- a/package.json +++ b/package.json @@ -52,6 +52,7 @@ }, "homepage": "https://axios-http.com", "devDependencies": { + "@babel/core": "^7.18.2", "@babel/preset-env": "^7.18.2", "@rollup/plugin-babel": "^5.3.1", "@rollup/plugin-commonjs": "^15.1.0", @@ -130,4 +131,4 @@ "Ben Carp (https://github.com/carpben)", "Daniel Lopretto (https://github.com/timemachine3030)" ] -} \ No newline at end of file +} From 128fa71843b65fa8d1fe4de0bdffa49a8dd7aaf0 Mon Sep 17 00:00:00 2001 From: "ronggui.shu" Date: Wed, 12 Oct 2022 13:34:54 +0800 Subject: [PATCH 2/2] fix: keep top-level export same with static properties(#5031) --- index.js | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/index.js b/index.js index 93d32fca9b..b5369d7842 100644 --- a/index.js +++ b/index.js @@ -1,2 +1,32 @@ import axios from './lib/axios.js'; + +// Keep top-level export same with static properties +// so that it can keep same with es module or cjs +const { + Axios, + AxiosError, + CanceledError, + isCancel, + CancelToken, + VERSION, + all, + Cancel, + isAxiosError, + spread, + toFormData +} = axios; + export default axios; +export { + Axios, + AxiosError, + CanceledError, + isCancel, + CancelToken, + VERSION, + all, + Cancel, + isAxiosError, + spread, + toFormData +}