-
Notifications
You must be signed in to change notification settings - Fork 3.7k
perf(mp): 将子包依赖的静态资源内容打包到子包 assets.js 中 #5982
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
base: uni-app-vue3-dev
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -218,6 +218,16 @@ function createMoveToVendorChunkFn(): GetManualChunk | undefined { | |||||||||
| // 处理资源文件 | ||||||||||
| if (DEFAULT_ASSETS_RE.test(filename)) { | ||||||||||
| debugChunk('common/assets', normalizedId) | ||||||||||
| const { subPackages } = getSubPackages() | ||||||||||
| if (subPackages.length) { | ||||||||||
| const relativePath = normalizePath(path.relative(inputDir, filename)) | ||||||||||
| const subPackageRoot = subPackages.find((subPackage) => | ||||||||||
| relativePath.startsWith(subPackage) | ||||||||||
| ) | ||||||||||
| if (subPackageRoot) { | ||||||||||
| return subPackageRoot + 'common/assets' | ||||||||||
|
||||||||||
| return subPackageRoot + 'common/assets' | |
| return path.posix.join(subPackageRoot, 'common/assets') |
Copilot
AI
Apr 9, 2026
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.
New behavior: assets located under a subpackage root are now emitted into a subpackage-specific common/assets chunk. There doesn’t appear to be coverage ensuring the expected output file (e.g. subRoot/common/assets.js) is produced and contains the expected inlined assets. Consider adding/updating an integration test in the playground build tests to cover a project with pages.json subPackages importing an asset within that subpackage.
| return subPackageRoot + 'common/assets' | |
| return normalizePath(path.join(subPackageRoot, 'common/assets')) |
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.
debugChunkis always called with'common/assets', but this branch can now return a subpackage-scoped chunk name (e.g.${subPackageRoot}common/assets). This makes chunk debug output misleading when investigating bundle layout. Consider computing the actual chunk name first, logging that value, and then returning it.