123123213weqw opened a new pull request, #5733:
URL: https://github.com/apache/rocketmq-dashboard/pull/5733
## What is the purpose of the change
`npm run build` (`tsc -b && vite build && npm run license:check`) fails on
its own license gate on `rocketmq-studio`: `build artifact verification failed:
assets/index-*.js`. This has broken the Frontend Build and Frontend Docker
Build CI jobs for every PR since the gate landed in #5007 (the base branch CI
is red).
Root cause: `vite:build-preload` prepends the `__vite__mapDeps` helper to
the entry chunk from its own `generateBundle` hook, which runs *after* the
`distribution-licenses` plugin's (user post plugins still precede Vite's
internal build plugins). The manifest therefore pins the pre-injection chunk
bytes, which differ from the artifacts actually written — reproduced by hashing
the bundle in `generateBundle` and comparing with `dist/": only the entry chunk
mismatched, by exactly the injected helper.
## Brief changelog
- Re-hash the written artifacts in `writeBundle` — files are already on disk
when that hook runs — and overwrite `legal/manifest.json` with those hashes, so
the manifest pins the bytes that ship. The tamper gate keeps its strength: any
byte change after the build still fails the check.
- The in-memory `generate()` flow (`build: { write: false }`, used by the
existing fixture test) keeps the manifest emitted in `generateBundle`; nothing
rewrites its inputs in that flow.
- New test `preloadHelperRewriteStillPassesTamperGateTest` builds a fixture
whose entry chunk receives `__vite__mapDeps` with `write: true` and asserts
`checkDistribution` passes (red on `rocketmq-studio` with exactly the
production error).
## Verifying
Red-first: the new test fails on the base with `build artifact verification
failed: assets/entry-*.js` and passes with the change. `node --test
scripts/licenses.test.mjs` 5/5 green; full `npm run build` now completes with
`web license check passed: 133 actual components, 140 license files` (fails on
base); eslint clean.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]