Closed MickL closed 2 weeks ago
ignore
is an array for glob patterns. Nitro uses glob
option for ignore scan patterns (plugins, routes, etc) + static assets.
This works on sandbox:
//https://nitro.unjs.io/config
export default defineNitroConfig({
ignore: ['routes/dev-only/**'],
compatibilityDate: '2024-11-08'
});
PS: Nitro 2.10 supports .dev
prefix in files to automatically exclude them from production :)
PS: Nitro 2.10 supports
.dev
prefix in files to automatically exclude them from production :)
Thats amazing! Does it work also in Nuxt with pages/components/assets or is it Nitro exlusive?
Also I wonder if this works with a folder?
/routes/temp.dev/tester.ts
The suffix is supported file-level -- but you can programmatically also add conditions flag to nitro.options.handlers
Nuxt has <DevOnly>
i can't recall TBH but i guess it did add support for .dev
for components, if not maybe worth making a proposal for Nuxt.
Shalll we close this issue? (please feel free to use discussions or discord always!)
'routes/dev-only/**'
Did the trick, thanks! The ignore option should be documented :)
Environment
Nitro: 2.10.4 Bun: 1.1.34 Node: 22.11.0
Reproduction
Describe the bug
In Nuxt we can set
ignore
array within nuxt.config.ts. In Nitro there seems to be the same option but it does nothing:Additional context
I want to disable some routes in product that are only for development.
Logs
No response