Conversation
… built stylesheets A stylesheet module is built on its first import, and the shared base is read from disk past the plugin, so styles extracted later were missing from webpack and Rsbuild output; Rsbuild also served a module-wide string kept only when it grew. The files the entries reach are now extracted before the build, the base on disk is kept current, and a compilation whose stylesheets changed is run once more, writing only the complete result. Rsbuild serves each stylesheet from the current sheet. Refs #686 Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Contributor
Changepacks@devup-ui/wasm@1.0.82 → 1.0.83 - bindings/devup-ui-wasm/package.jsonPatch
@devup-ui/bun-plugin@1.0.21 → 1.0.22 - packages/bun-plugin/package.jsonPatch
@devup-ui/components@0.1.59 → 0.1.60 - packages/components/package.jsonPatch
@devup-ui/eslint-plugin@1.0.21 → 1.0.22 - packages/eslint-plugin/package.jsonPatch
@devup-ui/next-plugin@1.0.89 → 1.0.90 - packages/next-plugin/package.jsonPatch
@devup-ui/plugin-utils@1.0.16 → 1.0.17 - packages/plugin-utils/package.jsonPatch
@devup-ui/rsbuild-plugin@1.0.66 → 1.0.67 - packages/rsbuild-plugin/package.jsonPatch
@devup-ui/vite-plugin@1.0.72 → 1.0.73 - packages/vite-plugin/package.jsonPatch
@devup-ui/webpack-plugin@1.0.70 → 1.0.71 - packages/webpack-plugin/package.jsonPatch
|
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.
문제
#686의 P0 두 건입니다. webpack과 Rsbuild 빌드 결과에서 스타일이 빠지거나 오래된 CSS가 나왔습니다.
devup-ui.css)가 특히 문제입니다. 각 파일의 stylesheet는 base를@import하는데, css-loader는 이@import를 인라인-!요청으로 바꾸고 이 요청은 플러그인 로더/transform을 거치지 않습니다. 그래서 base는 그 시점의 디스크 파일에서 그대로 읽혔습니다.CssExtractRspackPlugin+ css-loader 파이프라인): 늦게 로드된 파일의 전역 스타일(html{color:blue})이 빠짐.main플러그인으로 같은 결과.변경
src아래 파일을 경로 순서로 추출합니다. 도달하지 않는 파일(story, 사용하지 않는 파일)의 스타일은 들어가지 않습니다.computeReachableFiles를 추가했습니다. entry에서 static/dynamic import를 따라 도달하는 파일을 구합니다.src전체를 추출하던 동작을, 모든 production 빌드에서 entry 도달 파일을 추출하도록 바꿨습니다.onBeforeBuild에서 transform과 같은 파일 이름·옵션으로 추출합니다.finishModules에서 두 가지를 확인합니다. 하나라도 해당하면 최신 CSS를 파일로 쓰고needAdditionalPass로 한 번 더 컴파일합니다(실행당 최대 1회). 이때 첫 pass는processAssets(REPORT 단계)에서 산출물을 모두 지워 아무것도 쓰지 않으므로, 오래된 CSS 파일이dist에 남지 않습니다.src밖의 파일(monorepo 패키지, include 라이브러리)도 이 경로로 보장됩니다.cacheable(false)로 설정하고, 제공한 CSS를 컴파일 단위로 기록합니다. 플러그인과 로더는 서로 다른 모듈 인스턴스이므로 기록은globalThis에 둡니다.getCss(fileNum, !atomMode)를 반환하고, 모듈 전역globalCss와 길이 비교를 제거했습니다.rebuildModule: CSS 추출 파이프라인에서 rspack 2.2.1이 panic("should have event sender")해서 제외했습니다.새로 생기는 오류
없음.
검증
tsc(
@typescript/native)와 ESLint 통과루트
bun test5485 pass, 커버리지 100%실제 빌드 (임시 fixture, 늦은 파일은 delay loader로 재현)
src안에서만 늦음src밖 파일이 늦음experiments.css), per-file·singlesrc밖 파일이 늦음main플러그인src밖 파일이 늦음color:blue누락 (버그 재현)apps/rsbuild데모 빌드: 1 pass, CSS 정상rspack 실험으로
needAdditionalPass가CssExtractRspackPlugin+ css-loader에서 두 번째 pass에 최신 CSS를 내보내는 것을 확인Refs #686