question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Edge, IE issue SCRIPT1028: Expected identifier, string or number.

See original GitHub issue

we are using babel preset env to compile, however the vue-mapbox issue of the spread operator is causing issues with edge and ie 11.

this file: /node_modules/vue-mapbox/src/lib/withEvents.js

export default {
  methods: {
    /**
     * Emit Vue event with additional data
     *
     * @param {string} name EventName
     * @param {Object} [data={}] Additional data
     */
    $_emitEvent(name, data = {}) {
      this.$emit(name, {
        map: this.map,
        component: this,
        ...data
      });
    },

    /**
     * Emit Vue event with Mapbox event as additional data
     *
     * @param {Object} event
     */
    $_emitMapEvent(event, data = {}) {
      this.$_emitEvent(event.type, { mapboxEvent: event, ...data });
    }
  }
};

compiled reference {map:this.map,component:this,…e} is where the first issue is.

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:6

github_iconTop GitHub Comments

4reactions
audetcameroncommented, Aug 13, 2019

this issue was solved with


        {
          test: /\.m?js$/,
          exclude: /node_modules\/(?!(vue-mapbox)\/).*/,   //this fixed it,  
          use: [
            {
              loader: 'babel-loader',
              options: {
                presets: [
                  ['@babel/preset-env', {
                    debug: true,
                    useBuiltIns: 'usage'
                  }],
                ],
                plugins: [
                   '@babel/plugin-proposal-object-rest-spread',
                   '@babel/plugin-transform-spread'
                ]
              }
            }
          ]
        },
3reactions
Hawxycommented, Aug 30, 2019

Assuming you have @vue/cli-plugin-babel installed and your settings defined in babel.config.js, all you need to do is add transpileDependencies: ['vue-mapbox'] to your vue.config.js. You should practically never need to do manual configuration of webpack loaders in modern versions of Vue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Edge: SCRIPT1028: Expected identifier, string or number
It appears (surprisingly) that Edge doesn't support property rest yet, which is unfortunate but then it was officially added only in ES2018.
Read more >
[Bug Report] Not work in Edge, error:'SCRIPT1028 ... - GitHub
Note: I'm trying to run it on Edge, not IE. It says: "SCRIPT1028: SCRIPT1028: Expected identifier, string or number", pointing to my main.js ......
Read more >
SOLUTION: SCRIPT1028: Expected identifier, string or number
How to fix: SCRIPT1028: Expected identifier, string or number JavaScript error in earlier versions of Internet Explorer.
Read more >
Error - Expected identifier, string - Material Design for Bootstrap
Topic: [Error: SCRIPT1028: SCRIPT1028: Expected identifier, string or number] on DropdownToggle in Edge. Ragash free asked 3 years ago ...
Read more >
Blank page with Expected identifier, string or number on IE 11 ...
My Vue app works perfectly on every browser except IE and Edge, i get this error : Expected identifier, string or number chunk-vendors.js ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found