mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-11 08:33:53 +00:00
56 lines
1.5 KiB
Markdown
56 lines
1.5 KiB
Markdown
|
---
|
||
|
title: "Features"
|
||
|
description: "Enable or disable optional Nuxt features to unlock new possibilities."
|
||
|
---
|
||
|
|
||
|
Some features of Nuxt are available on an opt-in basis, or can be disabled based on your needs.
|
||
|
|
||
|
## `features`
|
||
|
|
||
|
### inlineStyles
|
||
|
|
||
|
Inlines styles when rendering HTML. This is currently available only when using Vite.
|
||
|
|
||
|
You can also pass a function that receives the path of a Vue component and returns a boolean indicating whether to inline the styles for that component.
|
||
|
|
||
|
```ts [nuxt.config.ts]
|
||
|
export defineNuxtConfig({
|
||
|
features: {
|
||
|
inlineStyles: true // or a function to determine inlining
|
||
|
}
|
||
|
})
|
||
|
```
|
||
|
|
||
|
### noScripts
|
||
|
|
||
|
Disables rendering of Nuxt scripts and JS resource hints. Can also be configured granularly within `routeRules`.
|
||
|
|
||
|
```ts [nuxt.config.ts]
|
||
|
export defineNuxtConfig({
|
||
|
features: {
|
||
|
noScripts: true
|
||
|
}
|
||
|
})
|
||
|
```
|
||
|
|
||
|
## `future`
|
||
|
|
||
|
There is also a `future` namespace for behavior that will likely become default in a early opting-in to new features that will become default in a future (possibly major) version of the framework.
|
||
|
|
||
|
### typescriptBundlerResolution
|
||
|
|
||
|
This enables 'Bundler' module resolution mode for TypeScript, which is the recommended setting
|
||
|
for frameworks like Nuxt and [Vite](https://vitejs.dev/guide/performance.html#reduce-resolve-operations).
|
||
|
|
||
|
It improves type support when using modern libraries with `exports`.
|
||
|
|
||
|
See [the original TypeScript pull request](https://github.com/microsoft/TypeScript/pull/51669).
|
||
|
|
||
|
```ts [nuxt.config.ts]
|
||
|
export defineNuxtConfig({
|
||
|
future: {
|
||
|
typescriptBundlerResolution: true
|
||
|
}
|
||
|
})
|
||
|
```
|