vuejs / vue

This is the repo for Vue 2. For Vue 3, go to https://github.com/vuejs/core
http://v2.vuejs.org
MIT License
207.96k stars 33.67k forks source link

IN I.E 11 vueJS don't work (Blank page) (SCRIPT1002: Syntax error vueapp.js) #9758

Closed alefrogers closed 5 years ago

alefrogers commented 5 years ago

Ambient: Laravel 5 with vuejs

Package.json

{
  "private": true,
  "scripts": {
    "dev": "npm run development",
    "development": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
    "watch": "npm run development -- --watch",
    "watch-poll": "npm run watch -- --watch-poll",
    "hot": "cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js",
    "prod": "npm run production",
    "production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --no-progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js"
  },
  "devDependencies": {
    "axios": "^0.18",
    "babel-cli": "^6.26.0",
    "babel-preset-env": "^1.7.0",
    "bootstrap": "^4.0.0",
    "cross-env": "^5.1",
    "jquery": "^3.2",
    "laravel-mix": "^2.0",
    "lodash": "^4.17.5",
    "popper.js": "^1.12",
    "vue": "^2.5.17",
    "vue-analytics": "^5.16.4",
    "vue-carousel": "^0.18.0-alpha",
    "vue-router": "^3.0.2",
    "vue-tag-manager": "^0.1.2"
  },
  "dependencies": {
    "babel-plugin-transform-class-properties": "^6.24.1",
    "babel-polyfill": "^6.26.0",
    "babel-preset-es2016": "^6.24.1",
    "es6-promise": "^4.2.6",
    "lodash": "^4.17.11",
    "vue-functional-calendar": "^1.3.2",
    "vue-resource": "^1.5.1",
    "vue-scrollto": "^2.13.0",
    "vue-simple-suggest": "^1.8.2",
    "vue2-google-maps": "^0.10.3"
  }
}

Problem:

In I.E 11 VueJS not work

SCRIPT1002: Syntax error vueapp.js (33684,41)

Line with error

function fromPath(obj, path) {
    return path.split('.').reduce((o, i) => o === Object(o) ? o[i] : o, obj);
}

My .babelrc


{
  "presets": [
    ["env", {
      "useBuiltIns": true,
      "modules": false,
      "targets": {
          "browsers": ["> 1%", "last 2 versions", "not ie <= 8"]
      }
    }]
  ]
}

My webpack.mix.js

mix.setPublicPath('../public_html');

mix.webpackConfig({
    module: {
        rules: [
            {
                test: /\.js$/,
                exclude: [/node_modules/],
                loader: 'babel-loader',
                options: {
                    presets: [['es2016']],
                    plugins: ["transform-vue-jsx", "transform-runtime"],
                }

            }
        ]
    }

});

mix.js('resources/js/app.js', './../public_html/js')
        .js('resources/js/vueapp.js', './../public_html/js')
        .sass('resources/sass/app.scss', './../public_html/css');

My vueapp.js

import 'babel-polyfill';
import 'es6-promise/auto';

import Vue from 'vue';
import VueRouter from 'vue-router';
import * as VueGoogleMaps from "vue2-google-maps";
import VueResource from 'vue-resource';
import VueCarousel from 'vue-carousel';
import VueScrollTo from 'vue-scrollto';
import VueAnalytics from 'vue-analytics';
import VueTagManager from "vue-tag-manager";

Vue.use(VueCarousel);
Vue.use(VueResource);
Vue.use(VueRouter);
Vue.use(VueScrollTo);
Vue.use(VueGoogleMaps, {
    load: {
        key: "xxxx"
    }
});
...
vue-bot commented 5 years ago

Hello, your issue has been closed because it does not conform to our issue requirements. In order to ensure every issue provides the necessary information for us to investigate, we require the use of the Issue Helper when creating new issues. Thank you!