公司新開發的項目須要兼容到IE9+html
就在index.html
頁面加入webpack
<meta http-equiv="X-UA-Compatible" content="IE=edge">
不起做用web
npm install babel-polyfill
npm
import("babel-polyfill")
babel
解決編譯錯誤----重要app
從新安裝一下webpack-dev-server npm install webpack-dev-server@2.6.1 若是有淘寶鏡像也可以使用 cnpm
修改 build/webpack.base.conf.js
下webpack-dev-server
app:['babel-polyfill','./src/main.js']
babel-preset-es2015-ie
根目錄下新建.babelrc
ui
{ "presets": [ ["env", { "modules": false, "targets": { "browsers": ["> 1%", "last 2 versions", "not ie <= 8"] } }], "stage-2" ], "plugins": ["transform-runtime"], "env": { "test": { "presets": ["env", "stage-2"], "plugins": ["istanbul"] } } }
npm run dev
spa