mirror of
https://github.com/nuxt/nuxt.git
synced 2024-12-04 03:17:14 +00:00
74ce29b329
* docs: remove `__dirname` and `__filename` from example code * fix: add `fileURLToPath` * Update packages/schema/src/config/server.ts Co-authored-by: pooya parsa <pyapar@gmail.com> * Update docs/content/2.guide/6.going-further/7.testing.md Co-authored-by: pooya parsa <pyapar@gmail.com> Co-authored-by: pooya parsa <pyapar@gmail.com>
56 lines
1.2 KiB
Markdown
56 lines
1.2 KiB
Markdown
# Custom build preset (advanced)
|
|
|
|
Get full control of Nuxt Nitro output to deploy on any kind of hosting platform.
|
|
|
|
::list{type=info}
|
|
|
|
- Allows full customization
|
|
- This is an advanced usage pattern
|
|
::
|
|
|
|
::alert{icon=IconPresets}
|
|
Back to [presets list](/guide/deployment/presets).
|
|
::
|
|
|
|
## Setup
|
|
|
|
You can create your own custom-built preset. See [the provided presets](https://github.com/unjs/nitro/tree/main/src/presets) for examples.
|
|
|
|
### Inline preset definition
|
|
|
|
You can define everything that a custom preset would configure directly in the Nitro options:
|
|
|
|
```ts [nuxt.config.js|ts]
|
|
export default {
|
|
nitro: {
|
|
// preset options
|
|
}
|
|
}
|
|
```
|
|
|
|
### Reusable preset
|
|
|
|
You can also define a preset in a separate file (or publish it as a separate npm package).
|
|
|
|
```ts [my-preset/index.ts]
|
|
import type { NitroPreset } from 'nitropack'
|
|
|
|
const myPreset: NitroPreset = {
|
|
// Your custom configuration
|
|
}
|
|
|
|
export default myPreset
|
|
```
|
|
|
|
Then in your `nuxt.config` you can specify that Nitro should use your custom preset:
|
|
|
|
```ts [nuxt.config.js|ts]
|
|
import { fileURLToPath } from 'node:url'
|
|
|
|
export default {
|
|
nitro: {
|
|
preset: fileURLToPath(new URL('./my-preset', import.meta.url))
|
|
}
|
|
}
|
|
```
|