|
1 | 1 | const fs = require("fs");
|
2 | 2 | const path = require("path");
|
| 3 | +const mkdirp = require("mkdirp"); |
3 | 4 | const { Tracer } = require("chrome-trace-event");
|
4 | 5 | const validateOptions = require("schema-utils");
|
5 | 6 | const schema = require("../../schemas/plugins/debug/ProfilingPlugin.json");
|
@@ -87,17 +88,16 @@ class Profiler {
|
87 | 88 |
|
88 | 89 | /**
|
89 | 90 | * @param {string} outputPath The ___location where to write the log.
|
90 |
| - * @param {Object} compiler Current compiler Instance |
91 | 91 | * @returns {Trace} The trace object
|
92 | 92 | */
|
93 |
| -const createTrace = (outputPath, compiler) => { |
| 93 | +const createTrace = outputPath => { |
94 | 94 | const trace = new Tracer({
|
95 | 95 | noStream: true
|
96 | 96 | });
|
97 | 97 | const profiler = new Profiler(inspector);
|
98 |
| - if (outputPath.match(/\/|\\/)) { |
99 |
| - const dir = path.dirname(outputPath); |
100 |
| - compiler.outputFileSystem.mkdirp(dir); |
| 98 | + if (/\/|\\/.test(outputPath)) { |
| 99 | + const dirPath = path.dirname(outputPath); |
| 100 | + mkdirp.sync(dirPath); |
101 | 101 | }
|
102 | 102 | const fsStream = fs.createWriteStream(outputPath);
|
103 | 103 |
|
@@ -164,7 +164,7 @@ class ProfilingPlugin {
|
164 | 164 | }
|
165 | 165 |
|
166 | 166 | apply(compiler) {
|
167 |
| - const tracer = createTrace(this.outputPath, compiler); |
| 167 | + const tracer = createTrace(this.outputPath); |
168 | 168 | tracer.profiler.startProfiling();
|
169 | 169 |
|
170 | 170 | // Compiler Hooks
|
|
0 commit comments