feat(v2): Allow plugins to consume webpack stats (#4021)

* refactor(v2): Allow plugins to consume webpack stats

Signed-off-by: Reece Dunham <me@rdil.rocks>

* Warn level only

* Fix issue

* Revert start.ts change
This commit is contained in:
Reece Dunham 2021-01-11 09:34:42 -05:00 committed by GitHub
parent a406a3c9aa
commit 66cc7364cd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 24 additions and 11 deletions

View file

@ -362,20 +362,23 @@ type Props = {
postBodyTags: string;
routesPaths: string[];
plugins: Plugin<any>[];
stats: Stats.ToJsonOutput;
};
```
Example:
```js {4-9} title="docusaurus-plugin/src/index.js"
```js {4-11} title="docusaurus-plugin/src/index.js"
module.exports = function (context, options) {
return {
name: 'docusaurus-plugin',
async postBuild({siteConfig = {}, routesPaths = [], outDir}) {
async postBuild({siteConfig = {}, routesPaths = [], outDir, stats}) {
// Print out to console all the rendered routes.
routesPaths.map((route) => {
console.log(route);
});
// Print out to console all the webpack stats.
console.log(stats);
},
};
};