mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-12 00:27:21 +02:00
v2: prepare to move
This commit is contained in:
parent
dc7ef96849
commit
45736200b0
172 changed files with 0 additions and 0 deletions
27
v2/lib/webpack/utils.js
Normal file
27
v2/lib/webpack/utils.js
Normal file
|
@ -0,0 +1,27 @@
|
|||
const merge = require('webpack-merge');
|
||||
|
||||
// Modify the generated webpack config with normal webpack config
|
||||
function applyConfigureWebpack(userConfig, config, isServer) {
|
||||
if (typeof userConfig === 'object') {
|
||||
return merge(config, userConfig);
|
||||
}
|
||||
if (typeof userConfig === 'function') {
|
||||
const res = userConfig(config, isServer);
|
||||
if (res && typeof res === 'object') {
|
||||
return merge(config, res);
|
||||
}
|
||||
}
|
||||
return config;
|
||||
}
|
||||
|
||||
// Modify the generated webpack config with webpack-chain API
|
||||
function applyChainWebpack(userChainWebpack, config, isServer) {
|
||||
if (userChainWebpack) {
|
||||
userChainWebpack(config, isServer);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
applyConfigureWebpack,
|
||||
applyChainWebpack
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue