I’ve got a page `src/pages/drafts.js` that that I render some draft posts from, but only locally.

So, when `NODE_ENV` is production I’d like the route `/drafts` to be a 404.

```js
import React from 'react'

if (process.env.NODE_ENV !== 'development') {
  // Invoke 404 somehow...
}

const MyComponent = () => <span>smth</span>

```

I can cancel the rendering in the component by returning null.

```js
import React from 'react'

const MyComponent = () => {
  if (process.env.NODE_ENV !== 'development') {
    return null
  }

  return (
    <span>smth</span>
  )
}

```

But that’s suboptimal in many ways.

I could also navigate the 404 page:

```js
import React from 'react'
import { navigate } from 'gatsby'

const MyComponent = () => {
  React.useEffect(() => {
    if (process.env.NODE_ENV !== 'development') {
      navigate('/404');
    }
  })

  return (
    <span>smth</span>
  )
}

```

This works, but if you load the route `/404` the HTTP status code is 200 and not 404.

I guess my question is, is there a way to to do a 404 before the template loads? Or somehow remove `src/pages/drafts.js` in a non development env?