gpt4 book ai didi

javascript - 部署到 Heroku 期间出现扩展运算符语法错误

转载 作者:行者123 更新时间:2023-12-02 22:06:08 33 4
gpt4 key购买 nike

当我将应用程序部署到 Heroku 时,出现以下错误:

remote: SyntaxError: src/resolvers/Mutation.js: Unexpected token (21:16)
remote: 19 | const user = await prisma.mutation.createUser({
remote: 20 | data: {
remote: > 21 | ...data,
remote: | ^
remote: 22 | password,
remote: 23 | permissions,
remote: 24 | authentication

在 Heroku 构建后阶段,剩余的传播未被识别。

我目前在 index.js 中有以下内容:

import '@babel/polyfill'

我的package.json:

  "dependencies": {
"@babel/polyfill": "^7.0.0",
"babel-cli": "^6.26.0",
"babel-plugin-transform-object-rest-spread": "^6.26.0",
"babel-preset-env": "^1.7.0",
"babel-register": "^6.26.0",
"bcryptjs": "^2.4.3",
"cross-fetch": "^2.2.2",
"env-cmd": "^8.0.2",
"google-auth-library": "^4.2.3",
"graphql": "^0.13.2",
"graphql-cli": "^2.16.4",
"graphql-yoga": "^1.14.10",
"jsonwebtoken": "^8.3.0",
"nodemailer": "^6.2.1",
"prisma-binding": "^2.1.1",
"stripe": "^7.1.0"
},
"devDependencies": {
"babel-plugin-transform-es2015-destructuring": "^6.23.0",
"jest": "^23.5.0",
"nodemon": "^1.17.5"
}

我尝试了_babelrc:

{
"presets": [
"env"
],
"plugins": [
"transform-object-rest-spread"
]
}

{
"presets": [
"react",
"es2015",
"stage-3",
"env"
],
"plugins": [
["@babel/plugin-proposal-object-rest-spread", { "loose": true, "useBuiltIns": true }],
"transform-es2015-destructuring"
]
}

{
"presets": [
"env",
"stage-0",
"react"
]
}

{
"presets": ["react", "es2015"],
"plugins": ["transform-es2015-destructuring", "transform-object-rest-spread"]
}

但是不起作用。不知道如何解决这个问题。
...................

最佳答案

_babelrc 不是 babel 可识别的配置格式文件——为了配置 babel,您需要使用 config files documentation 中列出的方法之一:

  • .babelrc
  • .babelrc.js
  • .babelrc.cjs
  • package.json

关于javascript - 部署到 Heroku 期间出现扩展运算符语法错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59710467/

33 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com