0
点赞
收藏
分享

微信扫一扫

“TypeError: _typeof2 is not a function“

大沈投资笔记 2022-01-07 阅读 127

问题:无法使用typeof判断数据类型

解决方案:更新badel相关包文件

1.卸载旧的babel-core、babel-plugin

npm un babel-core
npm un babel-plugin-transform-runtime

2.安装
 

npm i -D @babel/core
npm install --save-dev @babel/plugin-transform-runtime
npm install --save @babel/runtime

3.卸载

npm un babel-preset-env
npm un babel-preset-stage-0

4.安装

npm i @babel/preset-env

5,安装好后重启任务再试试,不行再走第6步,可以就不走第6步

6.修改babel文件

 plugins: [
        '@babel/plugin-syntax-dynamic-import',
        '@babel/plugin-transform-runtime',
        '@babel/plugin-transform-modules-commonjs'
    ],
    
    babel配置中加这个插件: @babel/plugin-transform-modules-commonjs
举报

相关推荐

0 条评论