1.0.0 • Published 8 years ago

performance-loader v1.0.0

Weekly downloads
2
License
MIT
Repository
github
Last release
8 years ago

performance-loader

Wraps modules in the browser performance API.

installation

npm install performance-loader --save-dev

Usage

Documentation: Using loaders

Example config

module.exports = {
  module: {
    loaders: [
      { loader: "performance-loader" },
    ]
  }
};

In browser

After initializing the page in a browser try:

console.table(
    window.performance.getEntriesByType('measure')
        .filter(p => p.duration > 1) // only modules that took longer than 1ms
        .sort((a, b) => b.duration - a.duration) // sort by descending duration
        .map(p => [p.name, p.duration]) // map for the table
)
// table of modules that took longer than 1ms to run