我遇到错误“模块构建失败:TypeError:this.setDynamic不是函数”。我的package.json有什么问题?
我更新到babel 7后出现错误:
npx babel-upgrade --write --install
package.json:
{
"private": true,
"scripts": {
// ...
},
"devDependencies": {
"@babel/core": "^7.0.0",
"@babel/plugin-proposal-class-properties": "^7.0.0",
"@babel/plugin-proposal-json-strings": "^7.0.0",
"@babel/plugin-syntax-dynamic-import": "^7.0.0",
"@babel/plugin-syntax-import-meta": "^7.0.0",
"@babel/plugin-transform-regenerator": "^7.0.0",
"@babel/plugin-transform-runtime": "^7.3.4",
"@babel/preset-env": "^7.0.0",
"axios": "^0.16.2",
"bootstrap-sass": "^3.4.1",
"cross-env": "^5.2.0",
"jquery": "^3.3.1",
"laravel-elixir": "^6.0.0-18",
"laravel-mix": "^1.7.2",
// ...
},
"dependencies": {
"@babel/runtime": "^7.3.4",
"babel-loader": "^8.0.0-beta.6",
"sass": "^1.17.3",
"vee-validate": "^2.1.7",
// ...
}
}
.babelrc:
{
"plugins": ["@babel/plugin-transform-runtime"]
}
堆栈跟踪
ERROR in ./resources/assets/js/app-home.js
Module build failed: TypeError: this.setDynamic is not a function
at PluginPass.pre (projectpath\node_modules\babel-plugin-transform-runtime\lib\index.js:31:12)
at transformFile (projectpath\node_modules\@babel\core\lib\transformation\index.js:78:27)
at runSync (projectpath\node_modules\@babel\core\lib\transformation\index.js:45:3)
at runAsync (projectpath\node_modules\@babel\core\lib\transformation\index.js:35:14)
at process.nextTick (projectpath\node_modules\@babel\core\lib\transform.js:34:34)
at process._tickCallback (internal/process/next_tick.js:61:11)
@ multi ./resources/assets/js/app-home.js ./resources/assets/sass/app.scss
ERROR in multi ./resources/assets/js/app-home.js ./resources/assets/sass/app.scss
Module not found: Error: Can't resolve 'sass-loader' in 'projectpath'
@ multi ./resources/assets/js/app-home.js ./resources/assets/sass/app.scss