Google 클라우드 기능을위한 코드를 작성 중입니다. URLSearchParams를 비롯한 URL 표준을 사용하고 싶습니다. 나는 그들이 Typescript dom lib의 일부라는 것을 알았고, 그래서 그것을 tsconfig libs 설정에 추가했다.Typescript dom lib를 서버에서 사용하는 방법은 무엇입니까?
그러나 클라우드 기능을 컴파일하고 배포 할 때 URLSearchParams가 정의되지 않았다는 런타임 오류가 발생합니다.
무엇이 누락 되었습니까?
{
"compilerOptions": {
/* Basic Options */
"target": "es6",
"module": "commonjs",
"lib": ["es6", "es7", "esnext", "dom"],
"sourceMap": true /* Generates corresponding '.map' file. */,
"outDir": "build" /* Redirect output structure to the directory. */,
"removeComments": true /* Do not emit comments to output. */,
/* Strict Type-Checking Options */
"strict": true /* Enable all strict type-checking options. */,
/* Additional Checks */
"noUnusedLocals": true /* Report errors on unused locals. */,
"noUnusedParameters": true /* Report errors on unused parameters. */,
"noImplicitReturns": true /* Report error when not all code paths in function return a value. */,
"noFallthroughCasesInSwitch": true /* Report errors for fallthrough cases in switch statement. */,
"plugins": [{ "name": "tslint-language-service" }],
"skipLibCheck": false
},
"include": ["src/**/*"],
"exclude": ["build"]
}
그리고 package.json 의존성 : 나는 TS 2.6
--- 편집을 사용하고 --- 여기
내 설정이다"dependencies": {
"circular-json": "^0.4.0",
"es6-promisify": "^5.0.0",
"firebase-admin": "^5.5.0",
"firebase-functions": "^0.7.3",
"invariant": "^2.2.2",
"joi": "12",
"lodash": "^4.17.4",
"node-fetch": "^2.0.0-alpha.9"
},
"devDependencies": {
"@types/circular-json": "^0.4.0",
"@types/invariant": "^2.2.29",
"@types/joi": "^13.0.0",
"@types/lodash": "^4.14.85",
"@types/node": "^8.0.52",
"@types/node-fetch": "^1.6.7",
"cpy-cli": "^1.0.1",
"del-cli": "^1.1.0",
"firebase-tools": "^3.15.1",
"tslint": "^5.8.0",
"tslint-config-prettier": "^1.6.0",
"tslint-language-service": "^0.9.6",
"typescript": "2.6"
}
(약식) package.config 및 tsconfig.json을 공유하여 재현 할 수 있습니까? – Fenton
개발 시간 동안 (.dts 파일 또는 tsconfig 파일에 있음) 함수가 존재하지만 런타임에 실패하면 실제 웹 사이트 (HTML 페이지)가 필요한 라이브러리 나 브라우저를로드하지 못했음을 의미합니다 사용하는 기능을 지원하지 않습니다. – Kokodoko
@Kokodoko 브라우저를 사용하고 있지 않습니다. 문제는 서버에서이 API *를 사용하는 방법입니다. –