All Projects → seleb → chunk-progress-webpack-plugin

seleb / chunk-progress-webpack-plugin

Licence: MIT license
Provides runtime progress events by replacing default webpack chunk loading with XHR

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to chunk-progress-webpack-plugin

Html Res Webpack Plugin
plugin for generating html in webpack
Stars: ✭ 170 (+900%)
Mutual labels:  webpack-plugin, chunk
chunk-splitting-plugin
Arbitrarily split your Webpack chunks and bundles into smaller pieces
Stars: ✭ 15 (-11.76%)
Mutual labels:  webpack-plugin, chunk
size-plugin-bot
A Github bot for size-plugin
Stars: ✭ 76 (+347.06%)
Mutual labels:  webpack-plugin
mangle-css-class-webpack-plugin
Minifies and obfuscates the class names in your existing JavaScript, CSS, and HTML without any modern css modules.
Stars: ✭ 96 (+464.71%)
Mutual labels:  webpack-plugin
generate-package-json-webpack-plugin
Generates a package.json file containing the external modules used by your webpack bundle
Stars: ✭ 59 (+247.06%)
Mutual labels:  webpack-plugin
prettier-eslint-webpack-plugin
Webpack plugin for prettier-eslint which ESLint's settings is set to JavaScript Standard Style
Stars: ✭ 24 (+41.18%)
Mutual labels:  webpack-plugin
chunks tutorial
Small demo showing how to load and manage tilemap chunks on the fly with Phaser 3
Stars: ✭ 41 (+141.18%)
Mutual labels:  chunk
webpack-stats-diff-plugin
Webpack plugin for reporting changes in bundle sizes across builds
Stars: ✭ 63 (+270.59%)
Mutual labels:  webpack-plugin
meteor-imports-webpack-plugin
Webpack plugin to import and use Meteor packages like if they were real NPM packages.
Stars: ✭ 25 (+47.06%)
Mutual labels:  webpack-plugin
stylelint-bare-webpack-plugin
Stylelint plugin for webpack
Stars: ✭ 15 (-11.76%)
Mutual labels:  webpack-plugin
transport-stream-online-segmenter
Transport stream web based HLS segmenter.
Stars: ✭ 30 (+76.47%)
Mutual labels:  chunk
webpack2-externals-plugin
Webpack 2+ fork of Webpack-Externals-Plugin
Stars: ✭ 14 (-17.65%)
Mutual labels:  webpack-plugin
image-sprite-webpack-plugin
A webpack plugin that generates spritesheets from your stylesheets.
Stars: ✭ 27 (+58.82%)
Mutual labels:  webpack-plugin
webpack-shower
🚿 Clean up, Arrange, Filter Webpack Stats
Stars: ✭ 12 (-29.41%)
Mutual labels:  webpack-plugin
css-chunks-html-webpack-plugin
Injecting css chunks extracted using extract-css-chunks-webpack-plugin to HTML for html-webpack-plugin
Stars: ✭ 22 (+29.41%)
Mutual labels:  webpack-plugin
module-mapping-webpack-plugin
Webpack plugin for mapping modules onto different files
Stars: ✭ 25 (+47.06%)
Mutual labels:  webpack-plugin
monaco-editor-esm-webpack-plugin
No description or website provided.
Stars: ✭ 25 (+47.06%)
Mutual labels:  webpack-plugin
chunkflow
Compose chunk operators to create a pipeline for local or distributed petabyte-scale computation
Stars: ✭ 36 (+111.76%)
Mutual labels:  chunk
flow-webpack-plugin
A webpack plugin allowing to call Flow type checker.
Stars: ✭ 36 (+111.76%)
Mutual labels:  webpack-plugin
inline-source-webpack-plugin
A webpack plugin to embed css/js resource in the html.
Stars: ✭ 18 (+5.88%)
Mutual labels:  webpack-plugin

chunk-progress-webpack-plugin

Replaces the default async chunk loader with one which uses XHR and triggers progress event on document.

Install

npm i --save-dev chunk-progress-webpack-plugin

or

yarn add --dev chunk-progress-webpack-plugin

Use

In config:

const ChunkProgressWebpackPlugin = require('chunk-progress-webpack-plugin');
...
{
	plugins: [
		new ChunkProgressWebpackPlugin()
	]
}

In application:

document.addEventListener('chunk-progress-webpack-plugin', function(event) {
	event.detail.loaded; // total bytes loaded
	event.detail.total; // total bytes requested
	event.detail.loaded / event.detail.total * 100; // total progress percentage
	const resource = event.detail.resource; // info about resource that triggered the event
	resource.loaded;
	resource.total;
	resource.url;
});

The root loaded/total values are reset to 0 when all concurrent loads complete. This is particularly useful for cases where user interaction is blocked while resources are loading (e.g. startup of a SPA or web game). In cases where multiple unrelated sections of code are importing resources asynchronously, the resource values are likely to be more useful.

A complete/100% progress event is not provided under the assumption that this can be handled on the complete of the original resource import; e.g. import('resource').then(()=>{/* fully loaded */})

XHR Caveats

Because this plugin makes webpack use XHR instead of JSONP to load resources, there are some things to keep in mind:

  • You may run into CORS issues (e.g. you won't be able to run the bundled result over file:// protocol in Chrome)
  • Extra HEAD requests are made to determine file-sizes
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].