问题
I have built an Excel add-in by React+Node+Umi. We have implemented our authentication system. The authentication works in Chrome and Safari, I just realized that it does not work well in IE11; F12
shows that 'Proxy' is undefined
.
Although it is an Excel add-in, we could reproduce the error (and the same error message) just in browser. Open the link https://jsaddin.10studio.tech/welcome/?next=formulaEditor in IE 11, sign in with ID 3094557608@qq.com
and password: 123456
. We could see the error message in F12.
Does anyone know
- how to fix this?
- how could I know which library/part of my code uses this
Proxy
? I may replace it by alternatives.
Edit 1: In .umirc.ts
:
treeShaking: true,
targets: {
ie: 9,
safari: 9,
},
In package.json
:
"umi": "^2.7.0",
"umi-plugin-react": "^1.8.0",
"umi-types": "^0.2.0"
Edit 2:
I tried yarn add proxy-polyfill
, then yarn start
. Curiously, it raised an error in localhost Invalid character
and 'umi' is undefined
:
回答1:
It looks like you are missing a polyfill. Did you check this config for umi.js? https://umijs.org/config/#targets
Setting the target of ie to 11 (as in the above link) should handle adding the polyfills you need.
targets: {
ie: 11,
...other browsers
},
...rest of the config
LE:
In case there is an issue with umi.js you can try adding the needed polyfills yourself (e.g. here is one for Proxy https://github.com/GoogleChrome/proxy-polyfill)
来源:https://stackoverflow.com/questions/60348709/proxy-is-undefined-in-ie