Unused assets and dead code bundled into a production extension inflate the download size every user pays on install and update, slow popup initialization as JavaScript is parsed, and expose development-only test fixtures or debug data that could leak internal implementation details. ISO 25010:2011 performance-efficiency.resource-utilisation applies: every unreferenced file is pure overhead. Source maps included in packaged extensions additionally expose original source code to any user who inspects the .crx.
Low because unused assets inflate bundle size and can expose internal paths, but do not directly break functionality or create immediate security risk.
Configure your bundler to exclude source maps, screenshots, and test fixtures from the production copy, and verify all remaining assets are referenced in manifest.json or code.
// webpack.config.js — exclude development artifacts from production
const CopyPlugin = require('copy-webpack-plugin');
module.exports = {
devtool: false,
plugins: [
new CopyPlugin({
patterns: [{
from: 'public',
globOptions: {
ignore: ['**/*.map', '**/screenshots/**', '**/test-fixtures/**'],
},
}],
}),
],
};
After building, run find dist/ -type f | sort -k1 -t/ | xargs ls -lh and cross-reference every file against manifest.json icon declarations and HTML <script>/<link> tags. Remove anything with no reference.
ID: extension-ux-performance.bundle-memory.no-unused-assets
Severity: low
What to look for: Examine the build output directory for assets that are not referenced by any manifest field, HTML file, or JavaScript file. Look for: duplicate icon sizes not declared in manifest icons, old screenshots or demo images accidentally committed to the extension root, development-only test fixtures included in the build, commented-out feature folders with assets, and build artifacts like .map files in the production package. Also check for dead JavaScript code — exported functions or modules that are never imported. List all assets in the extension directory and enumerate which are referenced in code vs. which are orphaned. Report: X of Y assets are referenced.
Pass criteria: All files in the production build directory are referenced by the extension. No .map source map files included in the packaged extension. No demo data, test fixtures, or unused icon sizes present. Tree-shaking is enabled in the bundler config. At least 1 implementation must be confirmed.
Fail criteria: Unreferenced assets (images, fonts, JSON files) are present in the build output. Source map files included in the packaged extension. Development fixtures or sample data bundled with the production build.
Skip (N/A) when: Build output directory is not present in the codebase (source-only repository).
Detail on fail: List the unreferenced assets. Example: "dist/ contains screenshots/demo.png (1.2MB) not referenced by manifest or any HTML file" or "Production build includes 6 .map files totaling 3.4MB — source maps should be excluded from packaged extension."
Remediation: Configure your bundler to exclude development artifacts:
// webpack.config.js
const CopyPlugin = require('copy-webpack-plugin');
module.exports = {
plugins: [
new CopyPlugin({
patterns: [
{
from: 'public',
globOptions: {
ignore: ['**/*.map', '**/screenshots/**', '**/test-fixtures/**'],
},
},
],
}),
],
devtool: false, // No source maps in production
};
Audit your manifest.json icon entries and remove icon sizes not declared there from the production copy.