vue打包后iphone 5c ios10.3.3打开报错,调试时无错误. 求解决办法

问题描述:

公司测试小哥的苹果5c在本地调试的时候是可以打开的. 蓝后.. 打包后页面打开空白,在别的手机上表现良好.(可能安卓低版本也会报错吧)

环境背景及尝试过的方法:

出现问题的手机是 10.3ios版本的苹果5c
问题出现后, 我尝试加载 babel-polyfill,es6-promise但没有卵用,依旧报同样的错误

相关代码

 main.js中
    import 'babel-polyfill'
    import Es6Promise from 'es6-promise'
    require('es6-promise').polyfill()
    Es6Promise.polyfill()
webpack.base.conf.js中也尝试过
    entry: {
        app: ["babel-polyfill","./src/main.js"]
    }

报错

  1. SyntaxError: Cannot declare a let variable twice: 't'. vendor.js
  2. TypeError: undefined is not an object (evaluating 'r[n].call')

各位大佬请问是我的开发方式不对吗? 寻求解决办法
.babelrc 代码

    {
      "presets": [
        ["env", {
          "modules": false,
          "targets": {
            "browsers": ["> 1%", "last 2 versions", "not ie <= 8"]
          }
        }],
        "stage-2"
      ],
      "plugins": ["transform-vue-jsx", "transform-runtime"],
      "env": {
        "test": {
          "presets": ["env", "stage-2"],
          "plugins": ["istanbul"]
        }
      }
    }

webpack.base.conf.js

  'use strict'
    const path = require('path')
    const utils = require('./utils')
    const config = require('../config')
    const vueLoaderConfig = require('./vue-loader.conf')
    function resolve (dir) {
      return path.join(__dirname, '..', dir)
    }

    module.exports = {
      context: path.resolve(__dirname, '../'),
      entry: {
        app: ["./src/main.js"]
      },
      output: {
        path: config.build.assetsRoot,
        filename: '[name].js',
        publicPath: process.env.NODE_ENV === 'production'
          ? config.build.assetsPublicPath
          : config.dev.assetsPublicPath
      },
      plugins: [
        new webpack.ProvidePlugin({
          $: "jquery",
          jQuery: "jquery",
          "windows.jQuery": "jquery"
        })
      ],
      resolve: {
        extensions: ['.js', '.vue', '.json'],
        alias: {
          'vue$': 'vue/dist/vue.esm.js',
          '@': resolve('src'),
        }
      },
      module: {
        rules: [
          {
            test: /\.vue$/,
            loader: 'vue-loader',
            options: vueLoaderConfig
          },
          {
            test: /\.js$/,
            loader: 'babel-loader',
            include: [resolve('src'), resolve('test'), resolve('node_modules/webpack-dev-server/client')]
          },
          {
            test: /\.(png|jpe?g|gif|svg)(\?.*)?$/,
            loader: 'url-loader',
            options: {
              limit: 10000,
              name: utils.assetsPath('img/[name].[hash:7].[ext]')
            }
          },
          {
            test: /\.(mp4|webm|ogg|mp3|wav|flac|aac)(\?.*)?$/,
            loader: 'url-loader',
            options: {
              limit: 10000,
              name: utils.assetsPath('media/[name].[hash:7].[ext]')
            }
          },
          {
            test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/,
            loader: 'url-loader',
            options: {
              limit: 10000,
              name: utils.assetsPath('fonts/[name].[hash:7].[ext]')
            }
          }
        ]
      },
      node: {
        // prevent webpack from injecting useless setImmediate polyfill because Vue
        // source contains it (although only uses it if it's native).
        setImmediate: false,
        // prevent webpack from injecting mocks to Node native modules
        // that does not make sense for the client
        dgram: 'empty',
        fs: 'empty',
        net: 'empty',
        tls: 'empty',
        child_process: 'empty'
      }
    }


2个回答

我出现了和你一样的问题,你的代码中是不是用了什么插件,比如swiper
vue开发SPA在ios10上的bug

我出现了和你一样的问题,你的代码中是不是用了什么插件,比如swiper
vue开发SPA在ios10上的bug https://blog.csdn.net/runonway/article/details/79278765

立即提问
相关内容推荐