Laravel-mix: Syntax Error in IE11

Created on 24 Jan 2018  路  11Comments  路  Source: JeffreyWay/laravel-mix

  • Laravel Mix Version: 2.0.0 (npm list --depth=0)
  • Node Version: 8.2.1 (node -v):
  • NPM Version: 5.6.0 (npm -v):
  • OS: Mac OS
  • Browser: Internet Explorer 11 - Windows 7 - VirtualBox

Description:

Without vendor extraction, getting one error SCRIPT1002: Syntax error in app.js:

Object.keys(Methods).foreach(methodName) => {
    ...
}

With vendor extraction, getting 2 errors in vendor.js and manifest.js:

SCRIPT1002: Syntax error
File: vendor.js, Line: 62, Column: 44

###

Object.keys(Methods).foreach(methodName) => {
    ...
}

SCRIPT1002: Unable to get property 'call' of undefined or null reference
File: manifest.js, Line: 55, Column: 12

###

modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);

Most helpful comment

Sorry, the errors actually generated by https://github.com/nolimits4web/Swiper/issues/2237 I have this imported for vendor extraction purpose.

All 11 comments

Can you share your mix config file code?

Just a basic config

let mix = require('laravel-mix');

mix.js('resources/js/app.js', 'public/assets/js');

Can you add a .babelrc stating that you want to support IE 11.

http://browserl.ist/?q=IE+11%2C+last+2+versions

Here is my .babelrc.

{
  "presets": [
    [
        "env", {
            "targets": {
                "browsers": ["last 2 versions"]
            }
        }
    ]
  ]
}

In the app.js there is only one line code for testing:

console.log('Hello world');

It works great using Edge's IE11 emulation on Windows 10, but when using the actual IE11 on VirtualBox it doesn't work.

Sorry, the errors actually generated by https://github.com/nolimits4web/Swiper/issues/2237 I have this imported for vendor extraction purpose.

I am having the same issue though I have no the nolimits4web/swiper package. Seems like the vendor.js and manifest.js doesn't get transpiled to es5.

EDIT: I found that https://github.com/sindresorhus/query-string is causing this issue.

image

image

same with mix v4

I am having the same issue though I have no the nolimits4web/swiper package. Seems like the vendor.js and manifest.js doesn't get transpiled to es5.

EDIT: I found that https://github.com/sindresorhus/query-string is causing this issue.

image

image

I am having the exact issue. Do you find any solution to this? I found that downgrading query-string to version 5 seems to solve this issue for now.

The quick fix for this issue is by importing the UMD version, I prefer to use an alias for swiper on my webpack.mix.js like so:

mix.webpackConfig({
    resolve: {
        alias: {
            'swiper': path.resolve(__dirname, 'node_modules/swiper/dist/js/swiper.js'),
        }
    }
});

I am having the same issue though I have no the nolimits4web/swiper package. Seems like the vendor.js and manifest.js doesn't get transpiled to es5.
EDIT: I found that https://github.com/sindresorhus/query-string is causing this issue.
image
image

I am having the exact issue. Do you find any solution to this? I found that downgrading query-string to version 5 seems to solve this issue for now.

I used the query-string-es5 package instead https://www.npmjs.com/package/query-string-es5

Was this page helpful?
0 / 5 - 0 ratings