mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-10 15:47:23 +02:00
feat: allow user to modify generated webpack config
This commit is contained in:
parent
2b5ee3e869
commit
10b1a38762
9 changed files with 172 additions and 3 deletions
|
@ -6,6 +6,7 @@ const globby = require('globby');
|
|||
const load = require('../load');
|
||||
const createServerConfig = require('../webpack/server');
|
||||
const createClientConfig = require('../webpack/client');
|
||||
const {applyConfigureWebpack} = require('../webpack/utils');
|
||||
|
||||
function compile(config) {
|
||||
return new Promise((resolve, reject) => {
|
||||
|
@ -36,8 +37,15 @@ module.exports = async function build(siteDir, cliOptions = {}) {
|
|||
|
||||
const props = await load(siteDir);
|
||||
|
||||
const serverConfig = createServerConfig(props).toConfig();
|
||||
const clientConfig = createClientConfig(props).toConfig();
|
||||
let serverConfig = createServerConfig(props).toConfig();
|
||||
let clientConfig = createClientConfig(props).toConfig();
|
||||
|
||||
// apply user webpack config
|
||||
const {
|
||||
siteConfig: {configureWebpack}
|
||||
} = props;
|
||||
clientConfig = applyConfigureWebpack(configureWebpack, clientConfig, false);
|
||||
serverConfig = applyConfigureWebpack(configureWebpack, serverConfig, true);
|
||||
|
||||
// Build the client bundles first.
|
||||
// We cannot run them in parallel because the server need to pickup the correct client bundle name
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue