Fix ProfilingPlugin for watch scenarios
This commit is contained in:
parent
016ec7bcdb
commit
718bd9bc1e
|
@ -123,9 +123,7 @@ class Profiler {
|
|||
* @returns {Trace} The trace object
|
||||
*/
|
||||
const createTrace = (fs, outputPath) => {
|
||||
const trace = new Tracer({
|
||||
noStream: true
|
||||
});
|
||||
const trace = new Tracer();
|
||||
const profiler = new Profiler(inspector);
|
||||
if (/\/|\\/.test(outputPath)) {
|
||||
const dirPath = dirname(fs, outputPath);
|
||||
|
@ -173,6 +171,7 @@ const createTrace = (fs, outputPath) => {
|
|||
counter,
|
||||
profiler,
|
||||
end: callback => {
|
||||
trace.push("]");
|
||||
// Wait until the write stream finishes.
|
||||
fsStream.on("close", () => {
|
||||
callback();
|
||||
|
@ -242,10 +241,10 @@ class ProfilingPlugin {
|
|||
stage: Infinity
|
||||
},
|
||||
(stats, callback) => {
|
||||
if (compiler.watchMode) return callback();
|
||||
tracer.profiler.stopProfiling().then(parsedResults => {
|
||||
if (parsedResults === undefined) {
|
||||
tracer.profiler.destroy();
|
||||
tracer.trace.flush();
|
||||
tracer.end(callback);
|
||||
return;
|
||||
}
|
||||
|
@ -293,7 +292,6 @@ class ProfilingPlugin {
|
|||
});
|
||||
|
||||
tracer.profiler.destroy();
|
||||
tracer.trace.flush();
|
||||
tracer.end(callback);
|
||||
});
|
||||
}
|
||||
|
|
|
@ -396,7 +396,7 @@ const describeCases = config => {
|
|||
done
|
||||
)
|
||||
) {
|
||||
compiler.close();
|
||||
compiler.close(() => {});
|
||||
return;
|
||||
}
|
||||
compiler.close(done);
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
it("compiles", function() {
|
||||
expect(WATCH_STEP).toBe("0");
|
||||
})
|
|
@ -0,0 +1,3 @@
|
|||
it("should not crash on recompile", function() {
|
||||
expect(WATCH_STEP).toBe("1");
|
||||
})
|
|
@ -0,0 +1,3 @@
|
|||
module.exports = [
|
||||
{ code: /DEP_WEBPACK_COMPILATION_NORMAL_MODULE_LOADER_HOOK/ }
|
||||
];
|
|
@ -0,0 +1,6 @@
|
|||
var webpack = require("../../../../");
|
||||
|
||||
/** @type {import("../../../../").Configuration} */
|
||||
module.exports = {
|
||||
plugins: [new webpack.debug.ProfilingPlugin()]
|
||||
};
|
Loading…
Reference in New Issue