Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/#38 JS SDK가 브라우저에서 동작하지 않는 이슈 #39

Merged
merged 2 commits into from
Aug 13, 2024

Conversation

LuizyHub
Copy link
Member

🚀 개발 사항

  • 브라우저 호환성 추가
  • endpoint 수정

이슈 번호

특이 사항 🫶

@LuizyHub LuizyHub added the 🐞 Bug 뭔가 작동하지 않아요 ㅠㅠ label Aug 13, 2024
@LuizyHub LuizyHub requested a review from a team August 13, 2024 07:05
@LuizyHub LuizyHub self-assigned this Aug 13, 2024
if (typeof window !== 'undefined') {
(window as any).LogBat = LogBat;
}

export default LogBat; No newline at end of file

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

코드 패치를 검토한 결과는 다음과 같습니다:

  1. 버그 위험:

    • apiEndpoint 변경이 기존 API와의 호환성을 깨뜨릴 수 있습니다. 이전 엔드포인트를 사용하는 코드가 있을 경우, 이로 인해 요청이 실패할 수 있습니다. 변경에 대한 문서화가 필요합니다.
  2. 개선 제안:

    • 상수 사용: apiEndpoint를 클래스 내부의 상수로 선언하는 것이 좋습니다. 타입을 명시함으로써 향후 코드 유지보수가 용이해집니다.
    • 주석 추가: 중요한 변경 사항이나 의도를 주석으로 명시하면 후속 개발자가 이해하기 쉬워집니다.
    • 타입 정의: window as any 대신 안전한 방식으로 객체 속성을 확장하는 것이 좋습니다. 이를 위해 적절한 타입 정의를 통해 TypeScript의 타입 안전을 활용할 수 있습니다.
  3. 형식 개선:

    • 꼭 필요한 경우가 아니라면 파일 끝에 공백 줄을 추가하는 것도 좋습니다. 이는 특정 형식을 유지하는 데 도움이 됩니다.

결과적으로, 변경 사항은 유익하지만 기존 시스템과의 연결성을 유지하도록 주의해야 하며, 코드 가독성을 높일 수 있는 여지가 있습니다.

export: 'default'
},
globalObject: 'this',
umdNamedDefine: true
},
devtool: isProduction ? 'source-map' : 'eval-source-map',
mode: isProduction ? 'production' : 'development',

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

코드 패치를 검토해보면 다음과 같은 개선 사항 및 버그 리스크를 제안할 수 있습니다:

  1. 구조 개선: library 설정을 객체로 변경한 것은 더 명확하고 확장성이 좋습니다. 이 점은 긍정적입니다.

  2. Type 정의: type: 'umd'로 변경한 것도 장점이지만, UMD에 대한 정의가 필요할 경우 문서나 주석 추가를 고려하는 것이 좋습니다.

  3. 버전 호환성: 사용하는 빌드 도구의 버전에 따라 umdNamedDefine 속성이 지원되지 않을 수 있으니, 해당 옵션의 지원 여부를 확인해야 합니다.

  4. 불필요한 프로퍼티: 만약 export: 'default'가 실제로 필요한 설정이라면 괜찮지만, 아니라면 코드 복잡성을 유발할 수 있으므로 사용 목적을 재검토할 필요가 있습니다.

  5. 개발 모드와 생산 모드: devtool 설정에서 모드에 따라 다른 소스 맵을 지정하는 것은 좋지만, 생산 모드에서는 성능을 고려해 더 경량화된 구성도 검토하는 것이 좋습니다.

종합적으로 보았을 때, 긍정적인 방향으로 변화하고 있으며, 몇 가지 세부 사항을 조정하면 더욱 안정적이고 효율적인 코드가 될 것입니다.

Copy link
Member

@tidavid1 tidavid1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍🏻

@LuizyHub LuizyHub merged commit a4d16f0 into dev Aug 13, 2024
1 check passed
@LuizyHub LuizyHub deleted the fix/#38 branch August 13, 2024 07:08
miiiinju1 pushed a commit that referenced this pull request Aug 13, 2024
* fix: 브라우저에서 동작 가능하게 개선

- 브라우저 호환

* fix: endpoint 변경
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐞 Bug 뭔가 작동하지 않아요 ㅠㅠ
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants