Skip to content

Commit

Permalink
Merge branch 'main' into changeset-release/main
Browse files Browse the repository at this point in the history
  • Loading branch information
ahabhgk authored Nov 19, 2024
2 parents 6fb710a + 522c39e commit 4c6ea10
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release-pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jobs:
# https://github.com/rspack-contrib/rspack-action
uses: rspack-contrib/rspack-action@rspack
with:
version: node ./x version ${{inputs.version || 'patch'}} --pre ${{inputs.prerelease || ''}}
version: node ./x version ${{inputs.version || 'patch'}} --pre ${{inputs.prerelease || 'none'}}
createGithubReleases: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
3 changes: 1 addition & 2 deletions crates/rspack_plugin_extract_css/src/plugin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -476,8 +476,7 @@ fn runtime_requirement_in_tree(
|_| false,
move |chunk, compilation| {
chunk
.content_hash(&compilation.chunk_hashes_results)
.expect("should have content hash")
.content_hash(&compilation.chunk_hashes_results)?
.contains_key(&SOURCE_TYPE[0])
.then(|| {
if chunk.can_be_initial(&compilation.chunk_group_by_ukey) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.a {
color: red;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
it("should modify runtime module source in main", async () => {
await import("./index.css");
expect(__webpack_require__.f.miniCss.test).toBeTruthy();
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
const webpack = require("@rspack/core");

class Plugin {
apply(compiler) {
compiler.hooks.compilation.tap("TestFakePlugin", compilation => {
compilation.hooks.runtimeModule.tap("TestFakePlugin", (module, chunk) => {
if (module.constructorName === "CssLoadingRuntimeModule") {
const originSource = module.source.source.toString("utf-8");
module.source.source = Buffer.from(
`${originSource}\n__webpack_require__.f.miniCss.test = true;\n`,
"utf-8"
);
}
});
});
}
}

/**@type {import("@rspack/core").Configuration}*/
module.exports = {
target: "web",
module: {
rules: [
{
test: /\.css$/,
use: [webpack.CssExtractRspackPlugin.loader, "css-loader"],
type: "javascript/auto"
}
]
},
plugins: [
new webpack.CssExtractRspackPlugin(),
new Plugin(),
]
};

0 comments on commit 4c6ea10

Please sign in to comment.