[Bug Report]: tap hooks processAssets will become unresponsive
System Info
System: OS: macOS 12.5 CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz Memory: 331.75 MB / 32.00 GB Shell: 5.8.1 - /bin/zsh Binaries: Node: 14.20.0 - ~/.nvm/versions/node/v14.20.0/bin/node Yarn: 1.22.19 - /usr/local/bin/yarn npm: 6.14.17 - ~/.nvm/versions/node/v14.20.0/bin/npm Browsers: Chrome: 109.0.5414.119 Safari: 15.6 npmPackages: @rspack/binding: workspace:* => 0.0.22 @rspack/core: workspace:* => 0.0.22 @rspack/dev-client: workspace:* => 0.0.22 @rspack/less-loader: workspace:^ => 0.0.22 @rspack/plugin-minify: workspace:^ => 0.0.22 @rspack/plugin-node-polyfill: workspace:^ => 0.0.22 @rspack/postcss-loader: workspace:^ => 0.0.22
Details
This case can repr
import path from "path";
import { Compiler, createCompiler } from "../src";
import lessLoader from "@rspack/less-loader";
import postcssLoader from "@rspack/postcss-loader";
const context = path.resolve(__dirname, "../../../examples/react-with-less");
class TestPlugin {
name = "test-plugin";
constructor() {}
apply(compiler: Compiler) {
compiler.hooks.thisCompilation.tap(this.name, compilation => {
compilation.hooks.processAssets.tapAsync("test", async () => {
return new Promise((resolve, reject) => {
setTimeout(() => {
resolve();
}, 1000);
});
});
});
}
}
const rspack = createCompiler({
entry: {
main: path.resolve(context, "./src/index.jsx")
},
context,
define: {
"process.env.NODE_ENV": JSON.stringify("development")
},
builtins: {
html: [{}]
},
plugins: [new TestPlugin()],
module: {
rules: [
{
test: /\.module\.less$/,
use: [
{ loader: lessLoader },
{
loader: postcssLoader,
options: {
modules: true
}
}
],
type: "css"
},
{
test: /\.less$/,
use: [{ loader: lessLoader }],
type: "css"
}
]
}
});
async function main() {
console.log("start");
rspack.build(err => {
console.log("end", err);
});
}
main();
Reproduce link
No response
Reproduce Steps
- paste file content to rspack/packages/rspack/example/react-with-less.ts
- npm run example
hooks.processAssets.tapAsync not work
but
hooks.processAssets.tapPromise is ok
it seems you need to pass callback style callback other than async function to tapAsync