diff --git a/docusaurus.config.js b/docusaurus.config.js index 5b8c9084..9088c50f 100644 --- a/docusaurus.config.js +++ b/docusaurus.config.js @@ -83,6 +83,28 @@ const config = { ], }, ], + function (context, options) { + return { + name: 'development-redirects', + configureWebpack(config, isServer, utils) { + if (process.env.NODE_ENV === 'development') { + return { + devServer: { + onBeforeSetupMiddleware: function (devServer) { + devServer.app.get('*', function (req, res, next) { + // If path doesn't start with /docs, redirect to Next.js + if (!req.path.startsWith('/docs/')) { + return res.redirect(`http://localhost:3000${req.path}`) + } + next() + }) + } + } + } + } + } + } + } ].filter(Boolean), themeConfig: { diff --git a/package.json b/package.json index 008859cf..c8fbbc54 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "private": true, "license": "Apache-2.0", "scripts": { - "start": "cross-env docusaurus start", + "start": "cross-env docusaurus start --port 3001", "prebuild": "docusaurus clear && node ./scripts/cleanup-guidelines", "build": "cross-env NO_UPDATE_NOTIFIER=true USE_SIMPLE_CSS_MINIFIER=true PWA_SW_CUSTOM= docusaurus build", "deploy": "docusaurus deploy",