vue-grid-layout supports IE11 description: missing ':'

I use "vue-grid-layout""^2.3.11", this version. Of course, version 12 also has issues; IE11 doesn't work. I found that the package is written in ES6, and some properties are not supported by IE.

So first we configure babel-loader to transpile

I use vuecli3 as follows:

module.exports = {
//....default configuration omitted

 configureWebpack(config) {
    config.module.rules.push({
      test: /\.js$/,
      use: [{
        loader: 'babel-loader'
       
      }],
      include:[ resolve('node_modules/webpack-dev-server/client'),
      resolve('node_modules/vue-grid-layout') ]
    })
  },


}

Done, run the code, we found the bug is fixed. If there is still an error,

Cannot get undefined or null

Then we add

cnpm i babel-polyfill -D

Reference it in main.js

import 'babel-polyfill'


Perfect solution


评论

暂无评论。

登录后可发表评论。