Hello,
My netlify site is:
https://frosty-jang-e884e2.netlify.app/
I’m experiencing a problem when using netlify dev
that is not present in the production environment.
I’m using next.js to create a statically generated site that will be hosted on the CDN. Within my site are directory slugs.
For example I’ve got a structure in my pages
directory like that reflects the use of a slug [locale]
in the path of my routes:
/pages/[locale]
/pages/[locale]/index.jsx
/pages/[locale]/puzzle.jsx
/pages/[locale]/recipient.jsx
Ultimately when I use next export
I get a site generated as expected and all works well in production. However when using netlify dev
I noticed that some of the statically generated javascript was not being loaded due to a 404 error
for all pages underneath the slug directory [locale]
.
Digging deeper I found that one of the files loaded with a slug route such as /en-CA/puzzle
, includes the square bracket characters as url encoded in the file name, like so:
Notice the %5Blocale%5D
which equates to [locale]
. In my local netlify dev
environment, when I hit theh the URL as generated by the site with url encoding, the file is not found. However if I modified the URL manually and use square brackets in place of the url encoded bits, the file loads properly.
This looks like a bug which could be fixed for netlify dev
if the server url-decodes the static file path before searching for it on the local drive.