Gulp 导出聚合时,Babel抛出一个类型错误

Gulp 导出聚合时,Babel抛出一个类型错误,gulp,syntax-error,babeljs,gulp-babel,babel-core,Gulp,Syntax Error,Babeljs,Gulp Babel,Babel Core,运行我的gulp任务时,出现以下错误: SyntaxError in plugin "gulp-babel" Message: /Users/******/Repos/******/src/scripts/config/index.js: Unexpected export specifier type > 1 | export * as constants from './constants'; ^^^^^^^^^^^^^^ 我不知道为什么会这样,因为

运行我的gulp任务时,出现以下错误:

SyntaxError in plugin "gulp-babel"
Message:
    /Users/******/Repos/******/src/scripts/config/index.js: Unexpected export specifier type
> 1 | export * as constants from './constants';
             ^^^^^^^^^^^^^^
我不知道为什么会这样,因为我正在运行允许ES6导入/导出所需的插件,或者我认为

.babelrc

{
    "presets": [
        "@babel/preset-env",
        "@babel/preset-react"
    ],
    "plugins": [
        "add-module-exports",
        "@babel/plugin-transform-modules-commonjs",
        "@babel/plugin-proposal-class-properties",
        "@babel/plugin-proposal-export-default-from"
    ]
}

package.json-我已经包括了完整的列表,其中大部分可能与此无关,但只是为了防止出现任何已知的包冲突

"dependencies": {
    "@babel/polyfill": "^7.8.3",
    "classnames": "^2.2.5",
    "concurrent-transform": "^1.0.0",
    "deep-freeze": "0.0.1",
    "eslint": "^3.17.1",
    "eslint-plugin-babel": "^3.2.0",
    "eslint-plugin-react": "^6.10.0",
    "git-rev": "^0.2.1",
    "gulp-awspublish": "^4.0.0",
    "gulp-sftp": "^0.1.5",
    "moment": "^2.18.1",
    "moment-timezone": "^0.5.26",
    "path": "^0.12.7",
    "qs": "^6.4.0",
    "react": "^16.8.4",
    "react-addons-css-transition-group": "^15.0.2",
    "react-dom": "^16.8.4",
    "react-fastclick": "^3.0.2",
    "react-redux": "^4.4.5",
    "react-router": "^3.2.5",
    "react-router-redux": "^4.0.8",
    "react-string-replace": "^0.4.0",
    "react-transition": "^1.0.3",
    "react-transition-group": "^2.7.0",
    "redux": "^3.5.2",
    "redux-thunk": "^2.3.0",
    "underscore": "^1.8.3"
  },
  "devDependencies": {
    "@babel/core": "^7.8.3",
    "@babel/plugin-proposal-class-properties": "^7.8.3",
    "@babel/plugin-proposal-export-default-from": "^7.8.3",
    "@babel/plugin-transform-modules-commonjs": "^7.8.3",
    "@babel/preset-env": "^7.8.3",
    "@babel/preset-es2015": "^7.0.0-beta.53",
    "@babel/preset-react": "^7.8.3",
    "axios": "^0.15.3",
    "babel-core": "^6.26.3",
    "babel-eslint": "^6.0.4",
    "babel-jest": "^25.1.0",
    "babel-loader": "^8.0.6",
    "babel-plugin-add-module-exports": "^1.0.2",
    "babel-polyfill": "^6.26.0",
    "babelify": "^9.0.0",
    "chai": "^3.5.0",
    "enzyme": "^2.7.1",
    "gulp": "^3.9.1",
    "gulp-autoprefixer": "^3.1.1",
    "gulp-babel": "^8.0.0",
    "gulp-browserify": "^0.5.1",
    "gulp-clean": "^0.3.2",
    "gulp-color": "0.0.1",
    "gulp-connect": "^5.0.0",
    "gulp-cssnano": "^2.1.2",
    "gulp-htmlmin": "^3.0.0",
    "gulp-livereload": "^3.8.1",
    "gulp-load-plugins": "^1.5.0",
    "gulp-mocha": "^4.3.0",
    "gulp-param": "^0.6.4",
    "gulp-rename": "^1.2.2",
    "gulp-sass": "^3.1.0",
    "gulp-sass-glob": "^1.0.8",
    "gulp-sourcemaps": "^2.4.1",
    "gulp-ssh": "^0.6.0",
    "gulp-streamify": "^1.0.2",
    "gulp-uglify": "^2.1.0",
    "gulp-watch": "^4.3.11",
    "gulp-webserver": "^0.9.1",
    "jest": "^25.1.0",
    "jsdom": "^9.12.0",
    "lint-staged": "^3.4.0",
    "mocha": "^3.2.0",
    "mocha-jsdom": "^1.1.0",
    "mocha-junit-reporter": "^1.13.0",
    "mock-require": "^2.0.1",
    "pre-commit": "^1.2.2",
    "prop-types": "^15.5.10",
    "react-addons-create-fragment": "^15.6.0",
    "react-addons-test-utils": "^15.6.0",
    "react-tools": "^0.13.3",
    "redux-mock-store": "^1.2.3",
    "run-sequence": "^1.2.2"
  }
非常感谢您的帮助,我真的很茫然

(使用节点v9.11.2)

来自

问题是,我们通过以下方式从“foo”支持中添加了导出*作为ns 默认为@babel/parser(在#10521中),但不为@babel/preset env

作为解决方法,您可以启用 @babel/插件建议从配置中导出名称空间

因此,将
@babel/plugin建议导出名称空间从
添加到您的
.babelrc
和开发依赖项中,您应该可以了


看起来这最终会被内置到预设的环境中,这样你就不必使用插件了。

你解决过这个问题吗?我也在吃同样的东西