Can I specify some pages not to be bundled when deploying to production? [workaround]

The Redwood Docs say:

FatalErrorPage isn’t bundled when deploying to production

Is there any way for me to specify more pages that I do not want bundled when deploying to production?

Thanks

@thedavid,

I’m using a SQL-Lite db to hold app config & theming options - it’s nice because the Dev can easily create and set config/theme options (thanks to the CRUD scaffolds)

I’m considering how to protect

any thoughts?

I could install DBAuth – but I don’t want to expose login pages

I was unable to figure out how to get the bundler to exclude the pages

So for now I am wrapping all the routes I do not want in prod behind a test, wrapped in a component to encapsulate the descision

type OnlyInDevelopmentLayoutProps = {
  children?: React.ReactNode
}

const OnlyInDevelopmentLayout = ({ children }: OnlyInDevelopmentLayoutProps) => {
  return /dev/.test(process.env.NODE_ENV) ? <>{children}</> : null
}

export default OnlyInDevelopmentLayout
// In this file, all Page components from 'src/pages` are auto-imported. Nested
// directories are supported, and should be uppercase. Each subdirectory will be
// prepended onto the component name.
//
// Examples:
//
// 'src/pages/HomePage/HomePage.js'         -> HomePage
// 'src/pages/Admin/BooksPage/BooksPage.js' -> AdminBooksPage

import { Set, Router, Route } from '@redwoodjs/router'
import BannersLayout from 'src/layouts/BannersLayout'
import ThemeFromUrlFragsLayout from 'src/layouts/ThemeFromUrlFragsLayout'
import ConfigsLayout from 'src/layouts/ConfigsLayout'
import ThemesLayout from 'src/layouts/ThemesLayout'
import ChainsLayout from 'src/layouts/ChainsLayout'

import OnlyInDevelopment from 'src/layouts/OnlyInDevelopmentLayout'

import ViewOnPhonePage from './pages/ViewOnPhonePage/ViewOnPhonePage'
import ViewOnKioskPage from './pages/ViewOnKioskPage/ViewOnKioskPage'

const Routes = () => {
  return (
    <Router>
      <Set wrap={OnlyInDevelopment}>
        <Set wrap={ThemeFromUrlFragsLayout}>
          <Route path="/theme-from-url-frags/new" page={ThemeFromUrlFragNewThemeFromUrlFragPage} name="newThemeFromUrlFrag" />
          <Route path="/theme-from-url-frags/{id:Int}/edit" page={ThemeFromUrlFragEditThemeFromUrlFragPage} name="editThemeFromUrlFrag" />
          <Route path="/theme-from-url-frags/{id:Int}" page={ThemeFromUrlFragThemeFromUrlFragPage} name="themeFromUrlFrag" />
          <Route path="/theme-from-url-frags" page={ThemeFromUrlFragThemeFromUrlFragsPage} name="themeFromUrlFrags" />
        </Set>
        <Set wrap={ThemesLayout}>
          <Route path="/themes/new" page={ThemeNewThemePage} name="newTheme" />
          <Route path="/themes/{id:Int}/edit" page={ThemeEditThemePage} name="editTheme" />
          <Route path="/themes/{id:Int}" page={ThemeThemePage} name="theme" />
          <Route path="/themes" page={ThemeThemesPage} name="themes" />
        </Set>
        <Set wrap={BannersLayout}>
          <Route path="/banners/new" page={BannerNewBannerPage} name="newBanner" />
          <Route path="/banners/{id:Int}/edit" page={BannerEditBannerPage} name="editBanner" />
          <Route path="/banners/{id:Int}" page={BannerBannerPage} name="banner" />
          <Route path="/banners" page={BannerBannersPage} name="banners" />
        </Set>
        <Set wrap={ConfigsLayout}>
          <Route path="/configs/new" page={ConfigNewConfigPage} name="newConfig" />
          <Route path="/configs/{id:Int}/edit" page={ConfigEditConfigPage} name="editConfig" />
          <Route path="/configs/{id:Int}" page={ConfigConfigPage} name="config" />
          <Route path="/configs" page={ConfigConfigsPage} name="configs" />
        </Set>
        <Set wrap={ChainsLayout}>
          <Route path="/chains/new" page={ChainNewChainPage} name="newChain" />
          <Route path="/chains/{id:Int}/edit" page={ChainEditChainPage} name="editChain" />
          <Route path="/chains/{id:Int}" page={ChainChainPage} name="chain" />
          <Route path="/chains" page={ChainChainsPage} name="chains" />
        </Set>
      </Set>

      <Route path="/vip/{altId}" page={ViewOnPhonePage} name="viewOnPhone" />
      <Route path="/vik/{altId}" page={ViewOnKioskPage} name="viewOnKiosk" />
      <Route path="/sp" page={SubmitPhonePage} name="submitPhone" />

      <Route notfound page={NotFoundPage} />
    </Router>
  )
}

export default Routes