问题
I have a fully built React application that I would like to deploy on IE 11, but been having no success but a white page.
For the sake of testing, I created a dummy app using npx create-react-app and attempted to launch on IE 11/Edge. Installing 'react-app-polyfill' and importing on 'react-app-polyfill/ie11' and 'react-app-polyfill/stable' on line 1 & 2 of index.js, I also included "last 1 ie version" in the browserlist.development inside the package.json file.
Every resource online points to react needing polyfill to be viewable on IE 11 but I haven't had any success. Any pointers greatly appreciated!
回答1:
What is your react-scripts
version? The issue is most likely related to react-scripts
version 3.3.0. You could find many issue reports in GitHub, for example: IE11 support doesn't work in dev mode, even after adding all polyfills and enabling ie11 support, Why application created using create-react-app is not working in IE browser?.
It can still work with react-scripts@3.2.0
. You could try to revert back to 3.2.0 as a workaround. Please also remember to delete .cache
folder in node_modules
and delete IE browser cache then try again.
来源:https://stackoverflow.com/questions/60105826/react-app-not-rendering-in-ie-11-even-with-polyfills