vue 移除严格模式

环境:使用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"]
}

评论 10
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值