mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-22 21:47:01 +02:00
chore: delay starting webpack-serve by one second
This commit is contained in:
parent
50894d824d
commit
2ba359f4ed
1 changed files with 31 additions and 29 deletions
|
@ -78,35 +78,37 @@ module.exports = async function dev(sourceDir, cliOptions = {}) {
|
|||
|
||||
// webpack-serve
|
||||
const nonExistentDir = path.resolve(__dirname, 'non-existent');
|
||||
await serve(
|
||||
{},
|
||||
{
|
||||
content: [nonExistentDir],
|
||||
compiler,
|
||||
open: false,
|
||||
devMiddleware: {
|
||||
logLevel: 'silent'
|
||||
},
|
||||
hotClient: {
|
||||
port: port + 1,
|
||||
logLevel: 'error'
|
||||
},
|
||||
logLevel: 'error',
|
||||
port,
|
||||
add: (app, middleware, options) => {
|
||||
const staticDir = path.resolve(sourceDir, 'public');
|
||||
if (fs.existsSync(staticDir)) {
|
||||
app.use(mount(publicPath, serveStatic(staticDir)));
|
||||
setTimeout(async () => {
|
||||
await serve(
|
||||
{},
|
||||
{
|
||||
content: [nonExistentDir],
|
||||
compiler,
|
||||
open: false,
|
||||
devMiddleware: {
|
||||
logLevel: 'silent'
|
||||
},
|
||||
hotClient: {
|
||||
port: port + 1,
|
||||
logLevel: 'error'
|
||||
},
|
||||
logLevel: 'error',
|
||||
port,
|
||||
add: (app, middleware, options) => {
|
||||
const staticDir = path.resolve(sourceDir, 'public');
|
||||
if (fs.existsSync(staticDir)) {
|
||||
app.use(mount(publicPath, serveStatic(staticDir)));
|
||||
}
|
||||
app.use(range); // enable range request https://tools.ietf.org/html/rfc7233
|
||||
app.use(
|
||||
convert(
|
||||
history({
|
||||
rewrites: [{from: /\.html$/, to: '/'}]
|
||||
})
|
||||
)
|
||||
);
|
||||
}
|
||||
app.use(range); // enable range request https://tools.ietf.org/html/rfc7233
|
||||
app.use(
|
||||
convert(
|
||||
history({
|
||||
rewrites: [{from: /\.html$/, to: '/'}]
|
||||
})
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
);
|
||||
);
|
||||
}, 1000);
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue