Home > Article > Web Front-end > How to solve the problem of blank project page when opening Vue 2.0 in IE11
This article mainly introduces to you the solution to the problem of blank project page opening in IE 11 in Vue 2.0. The article analyzes the reasons for this problem in detail and gives detailed solutions. Friends in need can refer to it. Let’s learn from it and learn it together.
Preface
Due to work needs, I have been learning Vue2.0 for a while. Recently, I am using the official scaffolding tool of Vue2.0 to build it. The project has been running without problems in chrome, but a bug appeared when opening it in ie11:
Problem
ie11 opened the vue2.0 project Blank, console error vuex requires a Promise polyfill in this browser;
Reason
Babel only converts new ones by default JavaScript syntax (syntax) without converting new APIs, such as Iterator, Generator, Set, Maps, Proxy, Reflect, Symbol, Promise and other global objects, as well as some methods defined on global objects (such as Object.assign) Will not transcode. To solve this problem, we use a technology called Polyfill (code filling, also translated as compatibility patch).
Simply put, polyfill is the code used to copy (meaning simulated copying, not copying) the native api that does not yet exist in the current running environment.
Solution
Installationbabel-polyfill
Steps
npm installation
npm install --save-dev babel-polyfill
Pour it into the entry file
import 'babel-polyfill'
If you also use the official scaffolding vue-cli, you also need to make various modifications in the webpack.config.js configuration file, use
module.exports = { entry: { app: ["babel-polyfill", "./src/main.js"] } };
Replace
module.exports = { entry: { app: './src/main.js' } }
The above is the entire content of this article. I hope it will be helpful to everyone’s study. Please pay attention to more related content. PHP Chinese website!
Related recommendations:
How to solve the problem of incorrect access path after packaging the Vue background image
How to solve the vue project Issue with blank page when opening after packaging
The above is the detailed content of How to solve the problem of blank project page when opening Vue 2.0 in IE11. For more information, please follow other related articles on the PHP Chinese website!