mirror of
https://github.com/facebook/docusaurus.git
synced 2025-08-02 08:19:07 +02:00
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:
parent
a406a3c9aa
commit
66cc7364cd
4 changed files with 24 additions and 11 deletions
|
@ -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);
|
||||
},
|
||||
};
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue