Slug routes not building in development
See original GitHub issueIn development, running npm run dev:rollup
and npm run dev:server
as instructed, routes in blog/route.js
are not being built.
For example, with the following in src/routes/blog/route.js
, /blog/hello-world
is “Not Found”:
module.exports = {
all: () => [{ slug: 'hello-world' }],
permalink: ({ request }) => `/blog/${request.slug}`,
};
After building with npm run build
and starting the dev server again, the route loads.
Subsequent changes to the Blog template do not cause dev:rollup
builds and are not reflected until npm run build
is executed again.
Is this expected behavior?
Issue Analytics
- State:
- Created 3 years ago
- Comments:14 (8 by maintainers)
Top Results From Across the Web
Build error when slug ends with .html for dynamic routes #12212
When running next build I get. Error: getStaticPaths can only be used with dynamic pages, not '/articles/[slug].html'.
Read more >Next.js routing from "pages/[...slug].js" not working
When navigating using the Link component from the index.js page to a [...slug].js page (e.g. /careers or /blog), everything works fine. BUT when ......
Read more >NextJS build error when slug ends with .html for dynamic routes
I have been working on converting a massive WordPress site (20K posts) to NextJS. Every post on this old site has .html in...
Read more >How to Create Dynamic Routes in Next.js - MakeUseOf
This will display the slug of the post. Dynamic Routing With getServerSideProps. Using Next.js you can fetch data at build time and create ......
Read more >Dynamic Routing in Next.js - Andrew Aquino
js docs about adding category pages for blog posts, I winged creating a new file to dynamically generate category pages, by duplicating and ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’ve fixed the rollup on the template as well. It won’t try and rollup an empty components folder.
OK sorted it out. It appears that we’re assuming a trailing slash in Elder.js. Add in a trailing slash in your
route.js
and it works.