Next.js: Issue with nesting index.js into folder

Created on 14 Jun 2017  ยท  5Comments  ยท  Source: vercel/next.js

I have noticed an issue with the HMR feature in the following configuration.
We have a full page reload instead of a hot reload when working on the root / route.

Still, It's working find for the /signin route or when renaming pro/index into pro/homepage.

  • folder structure:
pages/
โ”œโ”€โ”€ _document.js
โ”œโ”€โ”€ _error.js
โ”œโ”€โ”€ admin
โ”‚ย ย  โ”œโ”€โ”€ index.js
โ”‚ย ย  โ””โ”€โ”€ signin.js
โ””โ”€โ”€ pro
 ย ย  โ”œโ”€โ”€ index.js
 ย ย  โ””โ”€โ”€ signin.js
import nextRoutes from 'next-routes'

const routes = nextRoutes()
routes.add('pro/index', '/')
routes.add('pro/signin', '/signin')

export const Router = routes.Router
export const Link = routes.Link

export default routes

P.S: regarding why nesting the pages, the answer is subdomain handing.

Most helpful comment

Given how simple the fix is, I'm not sure I want to spend more time on that issue. I have raised it at it may sounds something trivial to fix for someone knowing the code base. Still, I could submit a new examples PR to show how people can handle subdomains with next if that something that match the vision of the project :).

All 5 comments

Could you send me a sample repo and clearly describe the error a bit more?

Given how simple the fix is, I'm not sure I want to spend more time on that issue. I have raised it at it may sounds something trivial to fix for someone knowing the code base. Still, I could submit a new examples PR to show how people can handle subdomains with next if that something that match the vision of the project :).

@fridays I'm not sure if it's related to next-routes. But do you have any idea? ๐Ÿ˜„

I can't reproduce, maybe it's related to the subdomain setup? A sample would be great.

Yeah, will work on a reproduction as this setup seems to no longer work with the v3-beta. I need to sort that out.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jesselee34 picture jesselee34  ยท  3Comments

olifante picture olifante  ยท  3Comments

lixiaoyan picture lixiaoyan  ยท  3Comments

timneutkens picture timneutkens  ยท  3Comments

irrigator picture irrigator  ยท  3Comments