Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
webpack-lighthouse-plugin
Advanced tools
Readme
This plugin allows you to run Lighthouse from a Webpack build.
npm install --save-dev webpack-lighthouse-plugin
In webpack.config.js
:
const WebpackLighthousePlugin = require('webpack-lighthouse-plugin');
module.exports = {
...
plugins: [
new WebpackLighthousePlugin({
url: 'http://localhost:9001'
})
],
...
}
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'
})
],
};
url
- the URL to run Lighthouse audits againstperf
- 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 disksaveArtifacts
- save all gathered artifacts to diskJust get the time to first meaningful paint, time-to-interactive and perceptual speed-index:
plugins: [
new WebpackLighthousePlugin({
url: 'https://airhorner.com',
perf: true
})
],
plugins: [
new WebpackLighthousePlugin({
url: 'https://airhorner.com',
disableCPUThrottling: false
})
],
plugins: [
new WebpackLighthousePlugin({
url: 'https://airhorner.com',
saveAssets: true
})
],
If you require even more data, you can also pass saveArtifacts: true
.
webpack-lighthouse-plugin
with real mobile devicesSimilar 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
})
],
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/'
})
],
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
.
Released under an Apache-2.0 license.
FAQs
A Lighthouse plugin for Webpack
The npm package webpack-lighthouse-plugin receives a total of 18 weekly downloads. As such, webpack-lighthouse-plugin popularity was classified as not popular.
We found that webpack-lighthouse-plugin demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.