-
-
Notifications
You must be signed in to change notification settings - Fork 9.2k
feat(css): added css-style-sheet to exportType for CSSStyleSheet return #20104
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
feat(css): added css-style-sheet to exportType for CSSStyleSheet return #20104
Conversation
| .another { | ||
| font-size: 16px; | ||
| } | ||
|
|
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.
Let's add url and @import here to ensure we handle them
alexander-akait
left a comment
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.
Let's improve a test case and we can merge
39ce594 to
fe75ab7
Compare
CodSpeed Performance ReportMerging #20104 will not alter performanceComparing Summary
|
56339ad to
909fe48
Compare
| )};` | ||
| ]); | ||
| } | ||
| } |
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.
Let's add a HMR test case, also there is import("./style.css", { with: { type: "css" } }), so make sense to have the only one runtime, just adding different code when export type is different
| "var rules = s.cssRules;", | ||
| "for (var j = 0; j < rules.length; j++) {", | ||
| Template.indent("cssTexts.push(rules[j].cssText);"), | ||
| "}" |
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.
Just caught this - do we handle CSS nesting here?
| return generateContext.runtimeTemplate.concatenation( | ||
| ...importCode, | ||
| moduleCode | ||
| ); |
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.
Maybe we still can use concatenation for text to avoid extra work in runtime? i.e. concatenation for text and runtime logic for css-style-sheet?
| // Child modules imported via @import should inherit this exportType | ||
| // instead of using the default "link", ensuring that the entire | ||
| // import chain uses the same export format. | ||
| const parent = state.compilation.moduleGraph.getIssuer(module); |
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.
What about to use parent module, because issuer not always can be (although the parent too, but it seems to me more intuitive than taking the issuer)
9688f85 to
2d15632
Compare
|
@xiaoxiaojx Let's make a rebase and we can merge |
2d15632 to
6b091d2
Compare
Summary
feat(css): added css-style-sheet to exportType for CSSStyleSheet return
What kind of change does this PR introduce?
feature
Did you add tests for your changes?
Yes
Does this PR introduce a breaking change?
No
If relevant, what needs to be documented once your changes are merged or what have you already documented?
Need to add docs for CSS exportType