自从升级 React 和 Babel 后,我的一个文件中出现了这个错误。这显然是一个幻像错误,因为之前一切正常,而且这个文件根本没有改变。有谁知道这里发生了什么以及我该如何解决?
错误
未捕获的错误:中继转换错误
Syntax Error FileXYZ - Unexpected character "\u2028".
9:用户ID
10:用户名^
在文件 XYZ 中。如果最近添加了参数/字段/类型,请尝试更新您的 GraphQL 架构。
我之前的package.json是这样的:
"dependencies": {
"babel-core": "^5.8.22",
"babel-loader": "^5.3.2",
"babel-polyfill": "^6.5.0",
"babel-preset-es2015": "^6.0.0",
"babel-preset-react": "^6.0.0",
"babel-relay-plugin": "^0.3.0",
"es5-shim": "^4.5.7",
"graphiql": "0.6.6",
"graphql": "^0.4.18",
"history": "1.13.1",
"isomorphic-fetch": "^2.1.1",
"react": "^0.14.8",
"react-addons-shallow-compare": "^0.14.0",
"react-chartjs": "^0.6.0",
"react-dom": "^0.14.0",
"react-loader": "^2.0.0",
"react-relay": "^0.4.0",
"react-router": "1.0.0-rc3",
"react-router-relay": "^0.7.0",
"superagent": "^1.2.0",
"webpack": "^1.13.1"
},
"devDependencies": {
"babel-eslint": "^3.1.30",
"babel-jest": "^5.3.0",
"jest-cli": "^0.9.0",
"react-addons-test-utils": "^0.14.0-beta3"
},
现在是这样的:
"dependencies": {
"babel-polyfill": "^6.9.1",
"babel-runtime": "^6.9.2",
"es5-shim": "^4.5.7",
"graphiql": "0.7.3",
"graphql": "^0.6.2",
"history": "1.13.1",
"isomorphic-fetch": "^2.1.1",
"react": "^15.2.1",
"react-addons-shallow-compare": "^15.2.1",
"react-dom": "^15.2.1",
"react-loader": "^2.0.0",
"react-relay": "^0.9.2",
"react-router": "1.0.0-rc3",
"react-router-relay": "^0.7.0",
"superagent": "^1.2.0"
},
"devDependencies": {
"babel-core": "^6.11.4",
"babel-eslint": "^6.1.2",
"babel-jest": "^13.2.2",
"babel-loader": "^6.2.4",
"babel-plugin-add-module-exports": "^0.2.1",
"babel-plugin-transform-runtime": "^6.9.0",
"babel-preset-es2015": "^6.9.0",
"babel-preset-react": "^6.11.1",
"babel-preset-stage-0": "^6.5.0",
"babel-preset-stage-1": "^6.5.0",
"babel-preset-stage-2": "^6.11.0",
"babel-relay-plugin": "^0.9.2",
"jest-cli": "^12.1.1",
"react-addons-test-utils": "^15.2.1",
"webpack": "^1.13.1"
},
到目前为止,我还无法更新 react-router 和 relay,因为它引入了许多重大更改,我无法完全解决这些更改,我在另一个问题中询问这个问题。
对此问题的任何帮助将不胜感激。谢谢!