2019-06-09vue移除严格模式

环境:使用vue-cli构建的项目

一 问题提出

问题场景:在使用MUI时,导入mui.js遇到use strict 问题
报错信息如下 :Uncaught TypeError: ‘caller’, ‘callee’, and ‘arguments’ properties may not be accessed on strict mode functions or the arguments objects for calls to them
具体详情如图:

二 问题解决

解决问题:使用babel-plugin-transform-remove-strict-mode移除严格模式
1.在项目根目录安装babel-plugin-transform-remove-strict-mode该插件

D:\workplace\vue_demo>npm install babel-plugin-transform-remove-strict-mode -D

2.修改项目根目录 .babelrc 文件
去掉 plugins 中的 “transform-vue-jsx”, “transform-runtime”,加入"transform-remove-strict-mode"
.babelrc 文件具体内容如下:


{
  "presets": [
    ["env", {
      "modules": false,
      "targets": {
        "browsers": ["> 1%", "last 2 versions", "not ie <= 8"]
      }
    }],
    "stage-2"
  ],
  "plugins": ["transform-remove-strict-mode"]
}


作者:belonghuang157405
来源:CSDN
原文:https://blog.csdn.net/belonghuang157405/article/details/86522930
版权声明:本文为博主原创文章,转载请附上博文链接!

注意:必须把 “@babel/plugin-transform-runtime”去掉

你可能感兴趣的:(2019-06-09vue移除严格模式)