All Projects → addyosmani → Webpack Lighthouse Plugin

addyosmani / Webpack Lighthouse Plugin

Licence: apache-2.0
A Webpack plugin for Lighthouse

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Webpack Lighthouse Plugin

Gimbal
Web Performance Auditing tooling
Stars: ✭ 99 (-63.47%)
Mutual labels:  lighthouse, performance
Webpack Libs Optimizations
Using a library in your webpack project? Here’s how to optimize it
Stars: ✭ 3,187 (+1076.01%)
Mutual labels:  webpack, performance
Lighthouse Monitor
Investigate performance over your whole company with lighthouse
Stars: ✭ 136 (-49.82%)
Mutual labels:  lighthouse, performance
Pwmetrics
Progressive web metrics at your fingertipz
Stars: ✭ 1,243 (+358.67%)
Mutual labels:  lighthouse, performance
Fast Uglifyjs Plugin
hight performance uglify plugin for webpack
Stars: ✭ 72 (-73.43%)
Mutual labels:  webpack, performance
Lightkeeper
Run Lighthouse tests in Pull Requests for multiple URLs with custom budgets
Stars: ✭ 83 (-69.37%)
Mutual labels:  lighthouse, performance
Autowebperf
AutoWebPerf provides a flexible and scalable framework for running web performance audits with arbitrary audit tools including PageSpeedInsights, WebPageTest and more.
Stars: ✭ 199 (-26.57%)
Mutual labels:  lighthouse, performance
Lighthouse Check Action
GitHub Action for running @GoogleChromeLabs Lighthouse audits with all the bells and whistles 🔔 Multiple audits, Slack notifications, and more!
Stars: ✭ 175 (-35.42%)
Mutual labels:  lighthouse, performance
Import Cost
displays the import size of the package you are importing inside the code editor
Stars: ✭ 1,021 (+276.75%)
Mutual labels:  webpack, performance
Bundlephobia
🏋️ Find out the cost of adding a new frontend dependency to your project
Stars: ✭ 6,640 (+2350.18%)
Mutual labels:  webpack, performance
Lighthouse Keeper
Keep an eye on Google Lighthouse score changes directly on GitHub 💡👀
Stars: ✭ 82 (-69.74%)
Mutual labels:  lighthouse, performance
Webpack.js.org
Repository for webpack documentation and more!
Stars: ✭ 2,049 (+656.09%)
Mutual labels:  webpack, performance
Garie
Open source web performance
Stars: ✭ 484 (+78.6%)
Mutual labels:  lighthouse, performance
Lighthouse Batch
Run Lighthouse analysis over multiple sites in a single command
Stars: ✭ 83 (-69.37%)
Mutual labels:  lighthouse, performance
Happypack
Happiness in the form of faster webpack build times.
Stars: ✭ 4,232 (+1461.62%)
Mutual labels:  webpack, performance
Awesome Bundle Size
📝 An awesome list of tools and techniques to make your web bundle size smaller and your web apps load faster.
Stars: ✭ 118 (-56.46%)
Mutual labels:  webpack, performance
Bundle Buddy Webpack Plugin
🐐🐐🐐🐐 bundle-buddy-webpack-plugin 🐐🐐🐐🐐
Stars: ✭ 199 (-26.57%)
Mutual labels:  webpack, performance
Grav
Performance visualisation tools
Stars: ✭ 262 (-3.32%)
Mutual labels:  performance
Vue2 Spa Tutorial
Vue2.x(即将升Vue 3)、 Webpack 4.x、Babel 7.x
Stars: ✭ 267 (-1.48%)
Mutual labels:  webpack
You May Not Know Vuejs
Vuejs 从入门到精通系列文章
Stars: ✭ 263 (-2.95%)
Mutual labels:  webpack

npm version npm

Webpack Lighthouse Plugin

This plugin allows you to run Lighthouse from a Webpack build.

Installation

npm install --save-dev webpack-lighthouse-plugin

Setup

In webpack.config.js:

const WebpackLighthousePlugin = require('webpack-lighthouse-plugin');

module.exports = {
  ...
  plugins: [
    new WebpackLighthousePlugin({
      url: 'http://localhost:9001'
    })
  ],
  ...
}

Example

Insert into your webpack.config.js:

const WebpackLighthousePlugin = require('webpack-lighthouse-plugin');

module.exports = {
  entry: 'sample.js',
  output: {
    filename: 'test.js'
  },
  plugins: [
    new WebpackLighthousePlugin({
      url: 'https://airhorner.com'
    })
  ],
};

API

  • url - the URL to run Lighthouse audits against
  • perf - only report Lighthouse performance audits (instead of the full Progressive Web App audits)
  • disableDeviceEmulation - disables device emulation (false by default)
  • disableCPUThrottling - disables cpu throttling (true by default)
  • disableNetworkThrottling - disables network throttling (false by default)
  • saveAssets - save the trace contents & screenshots to disk
  • saveArtifacts - save all gathered artifacts to disk

Examples

Performance metrics only

Just get the time to first meaningful paint, time-to-interactive and perceptual speed-index:

plugins: [
  new WebpackLighthousePlugin({
    url: 'https://airhorner.com',
    perf: true
  })
],

Test with CPU, network throttling and device emulation

plugins: [
  new WebpackLighthousePlugin({
    url: 'https://airhorner.com',
    disableCPUThrottling: false
  })
],

Save build assets (screenshots, trace and report):

plugins: [
  new WebpackLighthousePlugin({
    url: 'https://airhorner.com',
    saveAssets: true
    })
],

If you require even more data, you can also pass saveArtifacts: true.

Running webpack-lighthouse-plugin with real mobile devices

Similar to the Lighthouse module, this plugin can also be used with real phones. It works over remote debugging using the Android command line tools.

Before running the plugin as part of your Webpack build, run the following commands:

$ adb kill-server
$ adb devices -l
$ adb forward tcp:9222 localabstract:chrome_devtools_remote

You can then run webpack against your build and instead of firing up a Chrome instance on desktop, it'll do this with your mobile device Chrome instead. You will want to disable a few flags to improve the accuracy of your metrics:

plugins: [
  new WebpackLighthousePlugin({
    url: 'https://localhost:9000', // Port you are locally serving on
    disableDeviceEmulation: true,
    disableCPUThrottling: true,
    disableNetworkThrottling: true // Only if you're going to use real 3G
  })
],

Webpack Dev Server

Note: Webpack Dev Server targets development builds rather than production. Although you can run Lighthouse against a dev build, it's best run against builds closer to prod.

If you're trying to use webpack-dev-server with this plugin, first run it against your local build using the webpack-dev-server CLI:

$ webpack-dev-server build/
  http://localhost:8080/webpack-dev-server/

Then make sure to reference the webpack-dev-server URL in your WebpackLighthousePlugin config:

plugins: [
 new WebpackLighthousePlugin({
   url: 'http://localhost:8080/webpack-dev-server/'
 })
],

Developing

If opening a pull request, create an issue describing a fix or feature. Have your pull request point to the issue by writing your commits with the issue number in the message.

Make sure you lint your code by running npm run lint and you can build the library by running npm run build.

License

Released under an Apache-2.0 license.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].