-
Notifications
You must be signed in to change notification settings - Fork 0
Feature/beyondworm 116, shared 프로젝트 듀얼 모듈 (CommonJS/ESM) 지원 및 web-io-game 통합
#54
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
Conversation
Summary of ChangesHello @gangjung, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! 이 PR은 shared 라이브러리가 Node.js(백엔드)와 브라우저/번들러(프론트엔드) 환경 모두에서 효율적으로 사용될 수 있도록 CommonJS(CJS)와 ES Module(ESM) 두 가지 모듈 형식을 동시에 지원하도록 개선하고, 이를 web-io-game 프로젝트에 통합하는 것을 목표로 합니다. 이를 통해 라이브러리의 호환성과 유연성이 향상되며, 개발 편의성 및 디버깅 효율이 증대됩니다. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
shared 프로젝트에 듀얼 모듈(CommonJS/ESM) 지원을 추가하고 web-io-game에 통합하는 변경 사항을 검토했습니다. package.json의 exports 필드와 Vite의 조건부 설정을 사용하는 전반적인 접근 방식은 훌륭합니다. 하지만 package.json 설정에서 ESM을 사용하는 TypeScript 프로젝트의 타입 확인을 불가능하게 만드는 치명적인 문제를 발견했습니다. 또한, 빌드 스크립트의 크로스 플랫폼 호환성을 개선하기 위한 제안도 포함했습니다. tsconfig.json과 vite.config.ts의 다른 변경 사항들은 잘 적용된 개선 사항으로 보입니다.
shared/package.json
Outdated
| "exports": { | ||
| ".": { | ||
| "import": { | ||
| "types": "./dist/esm/index.d.ts", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
build 스크립트(28번 줄)에서 ESM 빌드 시 --declaration false 옵션으로 인해 타입 정의 파일(.d.ts)이 생성되지 않습니다. 따라서 현재 경로 (./dist/esm/index.d.ts)는 유효하지 않으며, 이 패키지를 ESM으로 사용하는 TypeScript 프로젝트에서 타입 오류를 발생시킵니다.
CJS와 ESM 모듈의 타입은 동일하므로, CJS 빌드에서 생성된 타입 정의 파일을 참조하도록 경로를 수정해야 합니다.
| "types": "./dist/esm/index.d.ts", | |
| "types": "./dist/cjs/index.d.ts", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
반영했습니다.
shared/package.json
Outdated
| }, | ||
| "scripts": { | ||
| "build": "tsc", | ||
| "build": "rm -rf dist && tsc && tsc --module ES2020 --outDir dist/esm --declaration false --declarationMap false", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
build 스크립트에 사용된 rm -rf 명령어는 Unix 기반 시스템(Linux, macOS)에서는 잘 동작하지만, 기본 Windows 환경에서는 호환성 문제가 발생할 수 있습니다.
모든 개발자가 동일한 환경에서 빌드를 성공시키기 위해, 플랫폼에 독립적인 rimraf와 같은 패키지를 사용하는 것이 좋습니다.
먼저 devDependencies에 rimraf를 추가해주세요 (npm install rimraf --save-dev 또는 yarn add rimraf --dev).
그 후 스크립트를 다음과 같이 수정하는 것을 제안합니다.
| "build": "rm -rf dist && tsc && tsc --module ES2020 --outDir dist/esm --declaration false --declarationMap false", | |
| "build": "rimraf dist && tsc && tsc --module ES2020 --outDir dist/esm --declaration false --declarationMap false", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
이부분은 윈도우 환경에서도 테스트 해볼 필요가 있을것 같습니다.
테스트 방법이 따로 있을까요?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@wkdnffla3
제가 윈도우로 한 번 테스트 해보고 결과 적을게요!
konempty
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
고생하셨습니다 👍 👍
제미나이가 리뷰 준거 무시해도 되는건지 확인 한번만 부탁드립니다!
shared/package.json
Outdated
| }, | ||
| "scripts": { | ||
| "build": "tsc", | ||
| "build": "rm -rf dist && tsc && tsc --module ES2020 --outDir dist/esm --declaration false --declarationMap false", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
이부분은 윈도우 환경에서도 테스트 해볼 필요가 있을것 같습니다.
테스트 방법이 따로 있을까요?
|
@wkdnffla3 @konempty |
|
고생하셧습니다!! |
|
@wkdnffla3 @konempty 확인 Comment : #54 (comment) |

우선, Github Pages의 deploy를 로컬에서 테스트 할 수 있는 방법을 찾아보았습니다. 그러나 저희 프론트에서는 따로 작업해줄 것이 없었습니다. 왜냐하면 저희는 Vite로 빌드한 것을 그대로 github pages에 호스팅하는 방식이기 때문입니다. 일반적으로 github pages는 Jekyll, React, Next 등을 사용합니다만, 저희는 그렇지 않기에 따로 로컬에서 테스트 할 수 있는 방법은 없는 것으로 보입니다.
목표: shared 라이브러리를 Node.js 환경(백엔드)과 브라우저/번들러 환경(프론트엔드)에서 모두 효율적으로 사용할 수 있도록 CommonJS(CJS)와 ES Module(ESM) 두 가지 모듈 형식을 동시에 지원하도록 개선하고, web-io-game 프로젝트에서 이를 통합합니다.
주요 변경 사항:
shared프로젝트 (듀얼 모듈 빌드 설정):package.json:tsconfig.json:web-io-game프로젝트 (shared통합 방식 개선):vite.config.ts:기대 효과: