当前位置:   article > 正文

ERROR Error: Cannot find module ‘babel-plugin-component‘_cannot find module 'babel-plugin-component

cannot find module 'babel-plugin-component

遇到这个错误,修改 babel.config.js 文件

  1. module.exports = {
  2.   presets: [
  3.     '@vue/cli-plugin-babel/preset',
  4.     ["@babel/preset-env", {"modules": false}]
  5.   ],
  6.   "plugins": [
  7.     [
  8.       "component",
  9.       {
  10.         "libraryName": "element-ui",
  11.         "styleLibraryName": "theme-chalk"
  12.       }
  13.     ]
  14.   ]
  15. }

把 babel.config.js 的内容替换为:

  1. module.exports = {
  2. presets: [
  3. '@vue/cli-plugin-babel/preset',
  4. ["@babel/env", {"modules": false}]
  5. ],
  6. "plugins": [
  7. [
  8. "component",
  9. {
  10. "libraryName": "element-ui",
  11. "styleLibraryName": "theme-chalk"
  12. }
  13. ]
  14. ]
  15. }

@babel/preset-vue   替换成   @babel/env

在执行命令重新下载 babel-plugin-component

在终端输入

npm install babel-plugin-component -S

本文内容由网友自发贡献,转载请注明出处:【wpsshop博客】
推荐阅读
相关标签
  

闽ICP备14008679号