Repository navigation
Conversation
Devup UI code in a project's own .js file is not compiled by the Bun plugin. A Bun runtime plugin must return the source of every file its filter matches, and Bun reads that source as an ES module, so matching local .js files would break CommonJS ones. Document the limitation and the .jsx/.tsx/.mjs workaround in the README and the limitations page. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. 🚀 New features to boost your workflow:
|
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.
Summary
PR #934 노트의 "Bun 런타임 플러그인은 프로젝트 자신의
.js를 컴파일하지 못한다"를 조사했습니다. 고칠 수 없다고 판단해 문서로 남깁니다.조사 (Bun 1.4.4, 런타임
plugin()+--preload)onLoad에서node_modules파일은undefined를 돌려 Bun에 넘김TypeError: onLoad() expects an object returned/^(?![\s\S]*[\\/]node_modules[\\/])[\s\S]*\.js$/node_modules밖.js만 받습니다. #934 노트의 "Bun filter는 lookahead를 지원하지 않는다"는 이 버전의 런타임 플러그인에는 맞지 않습니다.{ contents, loader: 'js' }반환.js(require,module.exports)는SyntaxError: Missing 'default' export로 깨집니다. Bun이 플러그인이 돌려준 소스를 ES module로 읽기 때문입니다. 플러그인 없이 실행하면 같은 파일이 정상입니다..js가 깨집니다. 어떤.js에 Devup UI가 있는지는 파일을 읽어야 알 수 있어 filter(경로만 봄)로는 가를 수 없습니다.loader: 'object'로require()결과를 넘기는 우회는 같은 hook에 재진입하고, ESM의 live binding / top-level await를 잃어 채택하지 않았습니다..js(설정 파일, 스크립트 등)를 깨뜨리지 않고는 고칠 수 없다고 판단했습니다.변경 (문서만)
packages/bun-plugin/README.md: "Compiled Files" 절 추가..ts/.tsx/.jsx/.mjs는 어디서든,.js는@devup-ui패키지 안에서만 컴파일되고, 프로젝트.js의 Devup UI 코드는 런타임 placeholder(Cannot run on the runtime)에 닿는다는 것,.jsx/.tsx/.mjs로 바꾸라는 우회, 그리고 이유.겹치는 PR
Bun.build에서는 프로젝트.js/.cjs도 컴파일하게 됩니다(빌드 hook은 값을 돌려주지 않아도 됨). #934가 머지되면 이 문서의 첫 문장을 "런타임에서는"으로 좁혀야 합니다.include에 나열한 패키지의.js도 컴파일합니다. 머지되면 "@devup-ui패키지" 부분에include를 더해야 합니다. 같은 README에 "Libraries" 절을 추가하므로 위치가 겹칠 수 있습니다.문서만 바꾸므로 changepack은 없습니다.
Test plan
bunx prettier --check(limitations mdx)git diff --stat: 라인 엔딩 churn 없음 (README는 index에서 CRLF/LF가 섞여 있어 원본 바이트를 유지해 삽입)Refs #686
🤖 Generated with Claude Code