next-translate: Bug when wrapping index in folder

Hello, we found a bug just before the deploy that blocks us from using this lib 😦.

If we wrap the pages_/index.tsx inside a folder, like index/index.tsx it will break on all the languages but default one when building static. Navigating to site.com/es throws a weird error on compiled js files.

How to reproduce

  1. Configure two or more languages
  2. Wrap your index page inside a folder pages_/index/index.tsx
  3. Build static and export
  4. Run a local server inside the dist folder and manually navigate to the index of any of the non-default language, like localhost:3000/es/

Output

dist/
β”œβ”€β”€ index.html
β”œβ”€β”€ my-page.html
β”œβ”€β”€ es.html
β”œβ”€β”€ es/
└── └── my-page.html

Expected output

dist/
β”œβ”€β”€ index.html
β”œβ”€β”€ my-page.html
β”œβ”€β”€ es/
β”œβ”€β”€ └── index.html
└── └── my-page.html

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 30 (13 by maintainers)

Most upvoted comments

Next 9.5 is out. I will try it with latest next-translate official release

I tried next 9.4.5-canary.8 + 0.17.1, 0.17.1-canary.1 and 0.17.1-canary.2 with the index folder. The default lang index.html is missing from the dist root:

pages_ and page:

Screenshot 2020-06-10 at 10 25 28

dist Screenshot 2020-06-10 at 10 23 44

@thissell @equinusocio I see that in Next.js 9.4.5-canary.8 version there is a PR changing this /index/index.js behavior.

Which Next.js version do you have? Can you try a Next.js version >= than 9.4.5-canary.8?

If it’s a Next.js issue, maybe we can revert a part of this PR: https://github.com/vinissimus/next-translate/pull/200 to keep the /index/index.js structure again.


@equinusocio I did another pre-release, 0.17.2-canary.2 with the change that you proposed (just copy the css/scss files instead of ignore them).

I’m getting the same issue. All subdirectories with index.js files simply call 404 requests. Bumping this for solidarity.

This is with wrapped index

Screenshot 2020-06-09 at 21 20 10

I’ve added an additional bug in this comment, but don’t know if it’s related to this one.

Nope 😦 it doesn’t seem to solve the issue. I tried:

  1. To move the css inside the src folder
  2. Same as the first point, but removing also the module from the filename
  3. Deleting the file entirely

Nothing is changing 😞. It doesn’t seem related to the css.