mirror of
https://github.com/facebook/docusaurus.git
synced 2025-04-30 02:37:59 +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
|
// docusaurus-plugin/src/index.js
|
||||||
module.exports = function(context, options) {
|
module.exports = function(context, options) {
|
||||||
return {
|
return {
|
||||||
name: 'docusaurus-plugin',
|
name: 'custom-docusaurus-plugin',
|
||||||
configureWebpack(config, isServer, utils) {
|
configureWebpack(config, isServer, utils) {
|
||||||
const {getCacheLoader} = utils;
|
const {getCacheLoader} = utils;
|
||||||
config.modules.rules.push({
|
return {
|
||||||
test: /\.foo$/,
|
module: {
|
||||||
use: [getCacheLoader(isServer), 'my-custom-webpack-loader'],
|
rules: [
|
||||||
});
|
{
|
||||||
return config;
|
test: /\.foo$/,
|
||||||
|
use: [getCacheLoader(isServer), 'my-custom-webpack-loader']
|
||||||
|
}
|
||||||
|
],
|
||||||
|
},
|
||||||
|
};
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
};
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
## postBuild(props)
|
## postBuild(props)
|
||||||
|
|
Loading…
Add table
Reference in a new issue