Vue.js 如何修复:this.setDynamic不是一个函数
我的babel配置有一些问题,不确定是什么 我看到的错误:Vue.js 如何修复:this.setDynamic不是一个函数,vue.js,webpack,babeljs,nuxt.js,babel-loader,Vue.js,Webpack,Babeljs,Nuxt.js,Babel Loader,我的babel配置有一些问题,不确定是什么 我看到的错误: ERROR Failed to compile with 1 errors friendly-errors 21:27:50 ERROR in ./.nuxt/client.js
ERROR Failed to compile with 1 errors friendly-errors 21:27:50
ERROR in ./.nuxt/client.js friendly-errors 21:27:50
Module build failed (from ./node_modules/@nuxt/webpack/node_modules/babel-loader/lib/index.js): friendly-errors 21:27:50
TypeError: this.setDynamic is not a function
my.babelrc看起来像这样:
{
"presets": [
[
"vue-app",
{
"useBuiltIns": true
}
],
"flow"
],
"plugins": ["@babel/plugin-proposal-decorators", "@babel/plugin-proposal-class-properties"],
"env": {
"test": {
"plugins": ["babel-jest-assertions", "transform-runtime"]
}
}
}
包锁,已安装的插件:
"@babel/core": "^7.4.5",
"@babel/preset-env": "^7.4.5",
"@nuxtjs/google-analytics": "^2.2.0",
"acorn": "^6.1.1",
"axios": "^0.18.1",
"babel-jest-assertions": "^0.1.0",
"babel-plugin-transform-decorators-legacy": "^1.3.5",
"babel-preset-flow": "^6.23.0",
要使此配置正常工作,需要更改哪些内容?已访问了各种stackoverflow答案,但尚未找到有效的修复方法
注释后更新的配置:
"@babel/plugin-transform-runtime": "^7.4.4",
"@babel/polyfill": "^7.4.4",
"@vue/babel-preset-app": "^3.0.0-rc.2",
"autoprefixer": "^7.1.2",
"babel-core": "^6.26.3",
"babel-eslint": "^8.2.3",
"babel-helper-vue-jsx-merge-props": "^2.0.3",
"babel-jest": "^21.0.2",
"babel-loader": "^8.0.0-beta.0",
"babel-plugin-dynamic-import-node": "^1.2.0",
"babel-plugin-syntax-jsx": "^6.18.0",
"babel-plugin-transform-es2015-modules-commonjs": "^6.26.0",
"babel-plugin-transform-imports": "^1.5.1",
"babel-plugin-transform-runtime": "^6.23.0",
"babel-plugin-transform-vue-jsx": "^3.5.0",
"babel-preset-env": "^1.3.2",
"babel-preset-stage-2": "^6.22.0",
"babel-register": "^6.22.0",
这个问题的答案是这样的。注意你的巴别塔配置(如评论中提到的)。Babel 6无法与Babel 7插件等一起正常工作。感谢您在评论中提供的所有帮助。您是否安装了
Babel插件转换运行时
?安装它并将其添加到您的插件“插件”:[“@Babel/plugin transform runtime”…]
@OrthoHomeDefense是的,我有。确认并重新运行后仍然看到相同的错误是什么版本?您也将其添加到插件部分了吗?您应该将“transform runtime”升级到“@babel/plugin transform runtime”,确保其更高版本7或更高版本。卸载babel插件transform runtime并安装@babel/plugin transform runtime,并确保安装@babel/runtime