Add typing for webpack profiling plugin

This commit is contained in:
Mohsen Azimi
2018-05-13 14:32:32 -07:00
parent 9028a63234
commit aaaa2a08e6
2 changed files with 28 additions and 0 deletions

View File

@@ -648,6 +648,27 @@ declare namespace webpack {
portableRecords?: boolean;
}
}
namespace debug {
interface ProfilingPluginOptions {
/** A relative path to a custom output file (json) */
outputPath?: string;
}
/**
* Generate Chrome profile file which includes timings of plugins execution. Outputs `events.json` file by
* default. It is possible to provide custom file path using `outputPath` option.
*
* In order to view the profile file:
* * Run webpack with ProfilingPlugin.
* * Go to Chrome, open the Profile Tab.
* * Drag and drop generated file (events.json by default) into the profiler.
*
* It will then display timeline stats and calls per plugin!
*/
class ProfilingPlugin extends Plugin {
constructor(options?: ProfilingPluginOptions);
}
}
namespace compilation {
class Asset {
}

View File

@@ -732,3 +732,10 @@ configuration = {
]
}
};
let profiling = new webpack.debug.ProfilingPlugin();
profiling = new webpack.debug.ProfilingPlugin({ outputPath: './path.json' });
configuration = {
plugins: [profiling]
};