zoukankan      html  css  js  c++  java
  • Module build failed: Error: Plugin/Preset files are not allowed to export objects, only functions.

    运行项目是提示Module build failed: Error: Plugin/Preset files are not allowed to export objects, only functions.

    原来是babel版本兼容问题

    在这里插入图片描述

    修改为

      "devDependencies": {
        "babel-core": "^6.26.0",
        "babel-eslint": "7.2.3",
        "babel-loader": "^7.1.2",
        "babel-plugin-transform-decorators-legacy": "^1.3.4",
        "babel-preset-es2015": "^6.24.1",
        "babel-preset-es2015-loose": "^8.0.0",
        "babel-preset-react": "^6.24.1",
        "babel-preset-stage-1": "^6.24.1",
    

    将高版本的babel配置做降级修改:
    原本的babelrc

    同步降级为:

    {
      "presets": [
        ["es2015", { "loose": true }],
        "stage-1",
        "react"
      ],
      "plugins": ["transform-decorators-legacy", "react-hot-loader/babel"]
    }
    
    

    重新 npm run dev 问题解决

  • 相关阅读:
    JavaScript
    多线程
    MySQL进阶一(基础查询)
    英语语法随笔1
    MySQL
    Love Story
    两个数组的交集
    只出现一次的数字
    MybatisPlus
    数组中值加一
  • 原文地址:https://www.cnblogs.com/dengxiaoning/p/14460939.html
Copyright © 2011-2022 走看看