[#24] fix: type: module 제거로 Node require() 호환성 해결 - #25
Merged
Conversation
4개 패키지(core/hono/koa/next)의 "type": "module" 제거. type: module 선언과 CJS 산출물(dist/cjs/*.js) 조합이 Node require()에서 exports is not defined 유발. ESM 산출물은 .mjs라 영향 없음. 타입 매핑을 빌드 산출물(index.d.mts / cjs index.d.ts)에 맞게 갱신. Refs #24
Contributor
✅ Changeset detectedLatest commit: 3c5ebc2
If no version change is needed, please add The changes in this PR will be included in the next version bump. This PR includes changesets to release 4 packages
|
Removed 'type: module' for Node require() compatibility.
Collaborator
Author
|
/canary-publish |
Contributor
|
No changed files exist under the . path, no packages have been deployed. |
added 2 commits
August 27, 2026 22:24
type: module 제거 후 기본값에 의존하던 것을 명시적 type: commonjs 로 확정. - require-type eslint 규칙 충족 (type 필수) - dist/cjs/*.js -> CommonJS, dist/esm/*.mjs -> ESM 확정 해석 (닫기: exports is not defined) Refs #24
Collaborator
Author
|
/canary-publish |
Contributor
|
No changed files exist under the . path, no packages have been deployed. |
kyungmi
marked this pull request as ready for review
August 27, 2026 13:50
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🔗 관련 이슈
✏️ 작업 내용
core/hono/koa/next4개 패키지의 package.json 에서"type": "module"을 제거했습니다."type": "module"인데dist/cjs/*.js는 CommonJS 문법(exports.X = ...,require("./x.js")) 으로 되어 있음require()로 로드할 때 해당 파일을 ESM 으로 오해 →ReferenceError: exports is not defined발생require()로 로드하는 환경에서 재현)"type": "module"제거.mjs확장자라 확장자만으로 ESM 으로 확정 → 영향 없음dist/cjs/*.js는type필드가 없어 기본값(CommonJS) 으로 정상 해석types경로를 갱신import.types:./dist/esm/index.d.ts→./dist/esm/index.d.mtsrequire.types:./dist/cjs/index.d.cts→./dist/cjs/index.d.tstypes:./dist/esm/index.d.ts→./dist/esm/index.d.mts추가 수정
📌 리뷰 요청 내용
type필드 제거가 다른 Node / 번들러 환경에 미치는 영향이 없는지 검토 부탁드립니다..d.mts/.d.ts) 변경이 올바른지 확인 부탁드립니다.✅ 검증
pnpm build4/4 성공node -e "require('@naverpay/prometheus-core')"/require('@naverpay/prometheus-koa')정상 동작 확인ReferenceError: exports is not defined발생 → 수정 후 해결node --input-type=module -e "import('@naverpay/prometheus-core').then(console.log)"node --input-type=module -e "import('@naverpay/prometheus-koa').then(console.log)"성공