Skip to content
Advertisement

Temporary disable Next.js pages on build

There are SSR-related problems with several pages in Next.js project that results in errors on npm run build and prevent the project from being built:

JavaScript

For example, bar:

JavaScript

As a quick fix, it may be convenient to just not build bar/*.* pages and make routes unavailable.

Can pages be ignored on Next.js build without physically changing or removing page component files in the project?

Advertisement

Answer

You can configure the pageExtensions in the next.config.js.

JavaScript

After configuring this, the only pages with *.page.js will be considered in the below given directory structure.

JavaScript

Custom file ignores patterns that are not supported yet. You can visit the PR created here, and the solution given here. This is the most satisfactory solution so far.

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement