mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-13 09:07:29 +02:00
feat: code split & use react helmet
This commit is contained in:
parent
bf1e30dc52
commit
406106b67e
19 changed files with 241 additions and 146 deletions
|
@ -4,7 +4,8 @@ const chalk = require('chalk');
|
|||
const fs = require('fs-extra');
|
||||
const globby = require('globby');
|
||||
const load = require('../load');
|
||||
const createProdConfig = require('../webpack/prod');
|
||||
const createServerConfig = require('../webpack/server');
|
||||
const createClientConfig = require('../webpack/client');
|
||||
|
||||
function compile(config) {
|
||||
return new Promise((resolve, reject) => {
|
||||
|
@ -35,11 +36,14 @@ module.exports = async function build(siteDir, cliOptions = {}) {
|
|||
|
||||
const props = await load(siteDir);
|
||||
|
||||
// create compiler from generated webpack config
|
||||
const config = createProdConfig(props).toConfig();
|
||||
const serverConfig = createServerConfig(props).toConfig();
|
||||
const clientConfig = createClientConfig(props).toConfig();
|
||||
|
||||
// compile!
|
||||
await compile(config);
|
||||
// we build the client bundles first
|
||||
await compile(clientConfig);
|
||||
|
||||
// then we build the server bundles (render the static HTML and pick client bundle)
|
||||
await compile(serverConfig);
|
||||
|
||||
// copy static files
|
||||
const {outDir} = props;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue