nuxt / nuxt/bridge

Feature proposal: backport `pages: true` option

Open
#687 1 comment 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

🍰 p2-nice-to-have enhancement
Dominant language
TypeScript
Stars
285
Forks
33
Avg merge
22h 38m
Merged PRs (30d)
3

Description

Environment
Reproduction
Describe the bug

Nuxt 3 allows us to pass pages: true in nuxt.config.ts to enable vue-router and prevent using default page. This helps in situation when all pages are defined via extendPages.
Bridge can have this feature too, because Nuxt 2 has build.createRotes, which tells builder to use vue-router even if pages folder does not exist.

Code, which we need to add to that file:

  if (config.pages && typeof config.build?.createRoutes !== 'function') {
    config.build = config.build || {}
    config.build.createRoutes = () => []
  }

So proposal is:

  1. Add the code above to the "config mormalizer" in module.cjs and also check how it works with disabled nitro.
  2. Update bridge-schema accordingly
  3. Decide, does we need to align behavior with Nuxt 2 or Nuxt 3, if this option turned off and pages folder does not exist. I didn't check that, but I think it differs.

I can help with 1 and 2 items

Additional context

No response

Logs

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in packages/bridge/module.cjs at the config normalizer and review the proposed pages/createRoutes interaction, including behavior when Nitro is disabled. Then inspect bridge-schema and compare the intended Nuxt 2 and Nuxt 3 behavior when pages is disabled or no pages folder exists. Done means the option is normalized, the schema is updated, and the compatibility behavior is explicitly settled.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, nuxtjs, typescript
Domain
build-system, web-dev
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.