它为什么要这么做?我以为它可以工作,但是在编写了一些包含?.语法的代码之后,它就停止工作了。我试图更新相关的依赖项,但没有结果。
贝娄有希望一切都是相关的。(命令为npm run generate:nexus)
package.json
{
"name": "rita",
"version": "0.0.0",
"license": "MIT",
"scripts": {
...
"generate:nexus": "ts-node --transpile-only --project=./apps/server/tsconfig.nexus.json ./apps/server/src/nexus-prisma/schema.ts"
},
"dependencies": { ... },
"devDependencies": {
...
"ts-node": "~9.1.0"
},
}tsconfig.nexus.json
{
"extends": "./tsconfig.json",
"compilerOptions": {
"baseUrl": ".",
"module": "CommonJS",
"target": "esnext",
"outDir": "dist",
"rootDir": "src",
"lib": ["esnext"],
"esModuleInterop": true,
"strict": true,
"typeRoots" : [
"node_modules/@types",
"./src/nexus-prisma/nexus.generated.ts",
],
//"extendedDiagnostics": true,
//"noEmit": true,
},
"files": [
"./src/nexus-prisma/schema.ts",
],
}错误:
ts-node --transpile-only --project=./apps/server/tsconfig.nexus.json ./apps/server/src/nexus-prisma/schema.ts
C:\project\apps\server\src\nexus-prisma\auth\maps.ts:47
districts: helpers_1.sanitizeParamList(query, 'f-d')?.map(v => +v),
^
SyntaxError: Unexpected token '.'
at wrapSafe (internal/modules/cjs/loader.js:1072:16)
at Module._compile (internal/modules/cjs/loader.js:1122:27)
at Module.m._compile (C:\project\node_modules\ts-node\src\index.ts:1056:23)
at Module._extensions..js (internal/modules/cjs/loader.js:1178:10)
at Object.require.extensions.<computed> [as .ts] (C:\project\node_modules\ts-node\src\index.ts:1059:12)
at Module.load (internal/modules/cjs/loader.js:1002:32)
at Function.Module._load (internal/modules/cjs/loader.js:901:14)
at Module.require (internal/modules/cjs/loader.js:1044:19)
at require (internal/modules/cjs/helpers.js:77:18)
at Object.<anonymous> (C:\project\apps\server\src\nexus-prisma\schema\carriers-of-offer\offer.ts:2:1)发布于 2021-07-27 15:03:58
没有编译错误,错误是所使用的节点不支持.?可选链接。
https://stackoverflow.com/questions/65574064
复制相似问题