The path(s) to the build directory or directories containing the production assets for the report. Can be absolute or relative.
Configuration options for generating and uploading the report.
Optional
bundleAnalyzerOptions: BundleAnalyzerOptionsOptional configuration for bundle-analyzer usage.
A promise that resolves when the report is generated and uploaded (dry-runned or uploaded).
const buildDirs = ['/path/to/build/directory', '/path/to/another/build']; // absolute or relative paths
const coreOpts = {
dryRun: true,
uploadToken: 'your-upload-token',
retryCount: 3,
apiUrl: 'https://api.codecov.io',
bundleName: 'my-bundle', // bundle identifier in Codecov
enableBundleAnalysis: true,
debug: true,
};
const bundleAnalyzerOpts = {
beforeReportUpload: async (original) => original,
ignorePatterns: ["*.map"],
normalizeAssetsPattern: "[name]-[hash].js",
};
createAndUploadReport(buildDirs, coreOpts, bundleAnalyzerOpts)
.then(() => console.log('Report successfully generated and uploaded.'))
.catch((error) => console.error('Failed to generate or upload report:', error));
Generated using TypeDoc
Generates a Codecov bundle stats report and optionally uploads it to Codecov. This function can be imported into your code or used via the bundle-analyzer CLI.