Skip to content

Commit 7337950

Browse files
committed
2 parents 592681c + bc9dbd5 commit 7337950

1 file changed

Lines changed: 33 additions & 0 deletions

File tree

README.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,39 @@ That means it won't account for post-processing from other plugins and also won'
231231

232232
Rollup allows you to output to multiple files. If you are outputting to multiple files you will get a distinct analysis for each output file. Each analysis will contain data on the files imported by the respective target.
233233

234+
One way to manipulate the number of reports in this scenario is through the `onAnalysis` callback option:
235+
236+
```js
237+
// Track iterations over output files
238+
let analyzePluginIterations = 0;
239+
240+
export default {
241+
input: 'myIsomorphicModule.js',
242+
output: [
243+
{
244+
name: 'myIsomorphicModule',
245+
format: 'cjs',
246+
entryFileNames: '[name].cjs'
247+
},
248+
{
249+
name: 'myIsomorphicModule',
250+
format: 'es',
251+
entryFileNames: '[name].mjs'
252+
}
253+
],
254+
plugins: [
255+
analyze({
256+
onAnalysis: () => {
257+
if (analyzePluginIterations > 0) {
258+
throw ''; // We only want reports on the first output
259+
}
260+
analyzePluginIterations++;
261+
}
262+
})
263+
]
264+
}
265+
```
266+
234267
## License
235268

236269
MIT © [Andrew Carpenter](https://github.com/doesdev)

0 commit comments

Comments
 (0)