-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Update esbuild.ts #12422
Update esbuild.ts #12422
Conversation
支持一下用户自定义esbuild的loader来处理.vue文件的处理
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 1 Ignored Deployment
|
Walkthrough在 Changes
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
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.
Actionable comments posted: 0
Outside diff range and nitpick comments (3)
packages/mfsu/src/loader/esbuild.ts (3)
Line range hint
1-5
: 使用 TypeScript 时,仅用作类型的导入应该使用import type
。- import { init, parse } from '@umijs/bundler-utils/compiled/es-module-lexer'; + import type { init, parse } from '@umijs/bundler-utils/compiled/es-module-lexer';
Line range hint
6-6
: Node.js 内置模块应该使用node:
协议导入。- import { extname } from 'path'; + import { extname } from 'node:path';
Line range hint
54-57
: 建议使用for...of
循环代替forEach
,以便更好地处理错误和性能。- handler.forEach((handle) => { + for (const handle of handler) { const [imports, exports] = parse(code); code = handle({ code, imports, exports, filePath }); - }); + }
Review Details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- packages/mfsu/src/loader/esbuild.ts (1 hunks)
Additional Context Used
Biome (3)
packages/mfsu/src/loader/esbuild.ts (3)
6-6: A Node.js builtin module should be imported with the node: protocol.
54-57: Prefer for...of instead of forEach.
1-5: Some named imports are only used as types.
Additional comments not posted (2)
packages/mfsu/src/loader/esbuild.ts (2)
Line range hint
11-22
: 映射表LOADER_MAP
设计得很好,涵盖了所有必要的扩展名。
42-42
: 调整transformOptions
中属性的顺序是正确的,确保loader
在展开其他选项之前被设置。
支持一下用户自定义esbuild的loader来处理.vue文件的处理
Summary by CodeRabbit
esbuild
加载器的配置顺序,提高了代码执行的稳定性和性能。