mirror of
https://github.com/facebook/docusaurus.git
synced 2025-04-30 18:58:36 +02:00
34 lines
899 B
JavaScript
34 lines
899 B
JavaScript
/**
|
|
* Copyright (c) 2017-present, Facebook, Inc.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*/
|
|
|
|
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,
|
|
};
|