How to use size-plugin - 1 common examples

To help you get started, we’ve selected a few size-plugin examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github preactjs / preact-www / preact.config.js View on Github external
});
	}

	// Fix keyframes being minified to colliding names when using lazy-loaded CSS chunks
	const optimizeCss = config.optimization && (config.optimization.minimizer || []).filter(plugin => /^OptimizeCssAssets(Webpack)?Plugin$/.test(plugin.constructor.name))[0];
	if (optimizeCss) {
		optimizeCss.options.cssProcessorOptions.reduceIdents = false;
	}

	Object.assign(config.optimization.splitChunks || (config.optimization.splitChunks = {}), {
		minSize: 1000
	});

	const sizePlugin = helpers.getPluginsByName(config, 'SizePlugin')[0];
	if (sizePlugin) {
		config.plugins[sizePlugin.index] = new SizePlugin({
			publish: true,
			filename: `size-plugin-${env.ssr?'ssr':'browser'}.json`
		});
	}
	if (!env.ssr) {
		// Find YAML FrontMatter preceeding a markdown document
		const FRONT_MATTER_REG = /^\s*---\n\s*([\s\S]*?)\s*\n---\n/i;

		// Find a leading title in a markdown document
		const TITLE_REG = /^\s*#\s+(.+)\n+/;

		// Converts YAML FrontMatter to JSON FrontMatter for easy client-side parsing.
		config.plugins.push(new CopyPlugin([{
			context: __dirname,
			from: 'content',
			to: 'content',

size-plugin

Tracks your Webpack asset sizes over time.

Apache-2.0
Latest version published 4 years ago

Package Health Score

50 / 100
Full package analysis

Popular size-plugin functions