使用外部babel配置会中断节点/反应应用-内部服务器错误

时间:2019-06-04 03:17:11

标签: node.js reactjs jestjs babel next.js

有人知道为什么会在}, "devDependencies": { "@babel/preset-env": "^7.4.5", "@babel/preset-react": "^7.0.0", "@svgr/cli": "^4.2.0", "babel-jest": "^24.8.0", "babel-preset-stage-2": "^6.24.1", "jest": "^24.8.0", "nodemon": "^1.19.1" } 上加载babel配置文件,为什么它会开始标记我的代码的完美部分吗?

我觉得它与Next.js有关。我的package.json(我正在测试的包)供参考:

npm run dev

我的目标是拥有同时运行npm testjest且不运行任何一个的应用。目前,如果我删除了所有的babel配置文件(需要运行jest),我的Web应用程序将完全正常启动。反之亦然。老实说,我不希望我在运行服务器时需要或希望任何babel配置文件处于活动状态,但我需要它们运行jest

那么...有一种方法可以从某些package.json脚本中禁用babel,或者以其他方式使void setBuildStatus(String message, String state) { env.COMMIT_JOB_NAME = "continuous-integration/jenkins/pr-merge/sanity-test" withCredentials([string(credentialsId: 'github-token', variable: 'TOKEN')]) { // 'set -x' for debugging. Don't worry the access token won't be actually logged // Also, the sh command actually executed is not properly logged, it will be further escaped when written to the log sh """ set -x curl \"https://api.github.com/repos/thanhlelgg/brain-and-brawn/statuses/$GIT_COMMIT?access_token=$TOKEN\" \ -H \"Content-Type: application/json\" \ -X POST \ -d \"{\\\"description\\\": \\\"$message\\\", \\\"state\\\": \\\"$state\\\", \ \\\"context\\\": \\\"${env.COMMIT_JOB_NAME}\\\", \\\"target_url\\\": \\\"$BUILD_URL\\\"}\" """ } } 测试正常运行而不会破坏应用程序的核心功能?

edit-i修复了它

1 个答案:

答案 0 :(得分:0)

//.babelrc

{
  "presets": [
    [
      "next/babel"
    ]
  ]
}