• EnglishEspañol日本語한국어Português
  • 로그인지금 시작하기

사용자의 편의를 위해 제공되는 기계 번역입니다.

In the event of any inconsistency between the English version and the translated version, the English versionwill take priority. Please visit this page for more information.

문제 신고

소스 맵 지원 활성화

TypeScript 또는 Babel로 작성된 것과 같은 트랜스파일된 애플리케이션은 일반적으로 소스 파일이 아닌 빌드된 파일 내의 파일, 라인 및 함수를 가리키는 오류 스택 추적을 표시합니다.

Node.js에서 소스 매핑을 활성화하면 소스 코드 내의 라인과 함수를 가리키는 보다 의미 있는 오류 추적을 얻을 수 있습니다.

소스 매핑을 활성화하는 방법

애플리케이션을 시작하는 node 명령에서 노드의 소스 맵 지원을 활성화할 수 있습니다.

bash
$
node --enable-source-maps -r newrelic ./dist/server.js

예시

소스 맵 지원 없이 실행되는 애플리케이션은 다음과 같은 오류 스택 추적을 표시할 수 있습니다.

bash
Error: Failed to get all entries in model
at /dist/models/entries.js:41:23
... (multiple functions in New Relic Node agent js files)
at /dist/models/entries.js:39:35
at Generator.next (<anonymous>)

추적은 /dist 에 있는 빌드된 파일을 참조합니다.

소스 맵 지원이 활성화된 동일한 애플리케이션은 대신 소스 코드 파일을 참조합니다.

bash
Error: Failed to get all entries in model
at <anonymous> (/src/models/entries.ts:28:13)
... (multiple functions in New Relic Node agent js files)
at <anonymous> (/src/models/entries.ts:26:19)
at Generator.next (<anonymous>)

이 스택 추적은 소스 파일 내의 특정 기능과 줄 번호를 가리키므로 오류를 더 쉽게 찾을 수 있습니다.

소스 맵 예제 애플리케이션 을 실행하여 이 동작을 관찰할 수 있습니다. 소스 맵이 활성화된 경우와 활성화되지 않은 경우 모두 오류 추적을 쉽게 비교할 수 있습니다.

Copyright © 2024 New Relic Inc.

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.