addyosmani / webpack-lighthouse-plugin

A Webpack plugin for Lighthouse
Apache License 2.0
290 stars 12 forks source link

output Json #4

Closed pedro93 closed 7 years ago

pedro93 commented 7 years ago

Hello,

I am investigating how to run performance audits locally with lighthouse and allow for performance budgets much like what webpack does with size budgets but giving the power to the user.

I am aware that running performance audits in a "dev environment" is less than ideal but this would be a first opt-in perf indicator and a tool to be improved upon.

The first step to doing this would be by retrieving the lighthouse results in JSON format and then evaluate them against user defined values.

Lighthouse as a standalone already enables JSON outputs but I am unable to retrieve those values from this plugin. Is it possible and an adequate functionality for this plugin?

Thanks for reading and for this OSS work :)

pedro93 commented 7 years ago

After reading a through a few lighthouse issues I found the following issue: https://github.com/GoogleChrome/lighthouse/issues/1176#issuecomment-267849211

Which would simply the code for this repository and enabled the output json flags (amongst others). If you feel so inclined I could make a PR as a proof-of-concept. What are your thoughts on this? I realize webpack as a primarily module bundler may not make since for this kind of work.

evenstensberg commented 7 years ago

Hi @pedro93 !

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

new WebpackLighthousePlugin({
   url: 'https://google.com/',
   output: 'json'
}),

should be sufficient after #7, please comment if it didn't address your issue correctly. Cheers 🍀