vue打包兼容IE11

  1. 确保安装过babel-loaderbabel-polyfill

    cnpm i babel-loader babel-polyfill -D
    
  2. 将webpack配置文件修改为

    entry: {
        app:['babel-polyfill', './src/main.js']
    }
    
    {
        test: /\.js$/,
        loader: 'babel-loader?cacheDirectory',
        include: [
            resolve('src'),
            resolve('test'),
            resolve('node_modules/_element-ui@2.4.7@element-ui/src'),
            resolve('node_modules/_element-ui@2.4.7@element-ui/package')
        ]
    }
    
    // 上述element-ui文件目录以本地 node_modules 中 element-ui 文件夹名称为准
    
  3. 重新打包即可