mirror of
https://github.com/facebook/docusaurus.git
synced 2025-04-29 10:17:55 +02:00
docs(v2): update custom webpack configuration snippet (#2139)
* Update custom webpack configuration snippet Fix #2097 * Update lifecycle-apis.md
This commit is contained in:
parent
d82615b94b
commit
7087425485
1 changed files with 12 additions and 7 deletions
|
@ -154,17 +154,22 @@ For example, this plugin below modify the webpack config to transpile `.foo` fil
|
|||
// docusaurus-plugin/src/index.js
|
||||
module.exports = function(context, options) {
|
||||
return {
|
||||
name: 'docusaurus-plugin',
|
||||
name: 'custom-docusaurus-plugin',
|
||||
configureWebpack(config, isServer, utils) {
|
||||
const {getCacheLoader} = utils;
|
||||
config.modules.rules.push({
|
||||
test: /\.foo$/,
|
||||
use: [getCacheLoader(isServer), 'my-custom-webpack-loader'],
|
||||
});
|
||||
return config;
|
||||
return {
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
test: /\.foo$/,
|
||||
use: [getCacheLoader(isServer), 'my-custom-webpack-loader']
|
||||
}
|
||||
],
|
||||
},
|
||||
};
|
||||
},
|
||||
};
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
## postBuild(props)
|
||||
|
|
Loading…
Add table
Reference in a new issue