ProfilingPlugin

ينشئ ملف profiling متوافقًا مع Chrome يحتوي على أوقات تنفيذ plugins. افتراضيًا يخرج الملف باسم events.json. ويمكنك تحديد ملف مخصص باستخدام outputPath.

ملاحظة: يقبل ProfilingPlugin المسارات المطلقة فقط.

الخيارات

  • outputPath: مسار مطلق إلى ملف JSON مخصص.

الاستخدام الافتراضي

new webpack.debug.ProfilingPlugin();

الاستخدام مع outputPath مخصص

import path from "node:path";
import { fileURLToPath } from "node:url";

const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);

new webpack.debug.ProfilingPlugin({
  outputPath: path.join(__dirname, "profiling/profileEvents.json"),
});

لعرض ملف profiling:

  1. شغّل webpack مع ProfilingPlugin.
  2. افتح Chrome DevTools ثم تبويب Performance، والذي كان يسمى سابقًا Timeline.
  3. اسحب الملف المولد، وهو events.json افتراضيًا، وأفلته داخل profiler.

سيعرض timeline الإحصاءات والاستدعاءات الخاصة بكل plugin.

Edit this page·

2 Contributors

MohaDev-69RlxChap2