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
|
// webpack-serve
|
||||||
const nonExistentDir = path.resolve(__dirname, 'non-existent');
|
const nonExistentDir = path.resolve(__dirname, 'non-existent');
|
||||||
await serve(
|
setTimeout(async () => {
|
||||||
{},
|
await serve(
|
||||||
{
|
{},
|
||||||
content: [nonExistentDir],
|
{
|
||||||
compiler,
|
content: [nonExistentDir],
|
||||||
open: false,
|
compiler,
|
||||||
devMiddleware: {
|
open: false,
|
||||||
logLevel: 'silent'
|
devMiddleware: {
|
||||||
},
|
logLevel: 'silent'
|
||||||
hotClient: {
|
},
|
||||||
port: port + 1,
|
hotClient: {
|
||||||
logLevel: 'error'
|
port: port + 1,
|
||||||
},
|
logLevel: 'error'
|
||||||
logLevel: 'error',
|
},
|
||||||
port,
|
logLevel: 'error',
|
||||||
add: (app, middleware, options) => {
|
port,
|
||||||
const staticDir = path.resolve(sourceDir, 'public');
|
add: (app, middleware, options) => {
|
||||||
if (fs.existsSync(staticDir)) {
|
const staticDir = path.resolve(sourceDir, 'public');
|
||||||
app.use(mount(publicPath, serveStatic(staticDir)));
|
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