Skip to content

Commit

Permalink
Improvements for side-by-side local dev (#80)
Browse files Browse the repository at this point in the history
Easier pattern for running "both apps together".

For public, we have a "private" nextJS frontend. :)
  • Loading branch information
goodroot authored Nov 25, 2024
1 parent 20ab8a9 commit 65f045e
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
22 changes: 22 additions & 0 deletions docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 65f045e

Please sign in to comment.