vue2项目IE11无法打开问题

问题1:

vue2项目在ie11上打开,一片空白。
解决:
  1. 安装bebel-polyfill
    npm install --save babel-polyfill
  2. 修改webpack.base.conf.js文件:
    app:后面的值变为数组,加上babel-polyfill,如下:
module.exports = {
    context: path.resolve(__dirname, '../'),
    entry: {
        app: ["babel-polyfill", "./src/main.js"],
 	 }
 	 ......
}
  1. 在main.js引入babel-polyfill:
    import 'babel-polyfill'

问题2:

引入babel-polyfill后,页面显示,但无法跳转页面。也看不到报错。
解决:

修改webpack.base.conf.js文件:
修改test: /\.js$/,下的include的值,增加, resolve('node_modules/ant-design-vue') ,这个解决引用的UI框架的编译问题。

module: {
    rules: [
 	{
        test: /\.js$/,
        loader: 'babel-loader',
        include: [resolve('src'), resolve('test'), resolve('node_modules/webpack-dev-server/client'), resolve('node_modules/ant-design-vue')],
        options: {
          plugins:[
            ['import',{libraryName:'antd', style:true}]
          ],
          // This is a feature of `babel-loader` for webpack (not Babel itself).
          // It enables caching results in ./node_modules/.cache/babel-loader/
          // directory for faster rebuilds.
          cacheDirectory: true,
        },
      }
    ]
}

你可能感兴趣的:(Vue)