TypeError: this.setDynamic is not a function

启动项目npm run serve 报错

Module build failed (from ./node_modules/[email protected]@babel-loader/lib/index.js):
TypeError: this.setDynamic is not a function

原因:vue项目用的是最新的babel7版本,在.babel.config.js中使用的还是之前的插件.babel7之后的插件一般都是以@babel开头的,下载新版的babel安装包之后再运行就可以了

package.json

"devDependencies": {
    "@babel/plugin-transform-runtime": "^7.5.5",
    "@babel/preset-env": "^7.5.5",
}
 
babel.config.js
module.exports = {
  presets: [
    '@vue/app'
  ],
  plugins: ["@babel/plugin-transform-runtime"],
  comments: false,
  env: {
    test: {
      presets: ["@babel/preset-env"],
      plugins: ["istanbul"]
    }
  }
}
 
 

猜你喜欢

转载自www.cnblogs.com/steamed-twisted-roll/p/11243398.html