@nuxt/docs-nightly 4.2.0-29334442.191bcb7e → 4.2.0-29335081.002c92c6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -61,9 +61,17 @@ There is also a `future` namespace for early opting-in to new features that will
61
61
 
62
62
  ### compatibilityVersion
63
63
 
64
- This is used for enabling early access to Nuxt features or flags.
64
+ This enables early access to Nuxt features or flags.
65
65
 
66
- It is not configurable yet in Nuxt 4, but once we begin merging breaking changes for v5, it will be possible to enable it.
66
+ Setting `compatibilityVersion` to `5` changes defaults throughout your Nuxt configuration to opt-in to Nuxt v5 behaviour.
67
+
68
+ ```ts
69
+ export default defineNuxtConfig({
70
+ future: {
71
+ compatibilityVersion: 5,
72
+ },
73
+ })
74
+ ```
67
75
 
68
76
  ### multiApp
69
77
 
@@ -63,3 +63,26 @@ import config from '~/data/hello.yaml'
63
63
  ```
64
64
 
65
65
  ::
66
+
67
+ ## Using Vite Plugins in Nuxt Modules
68
+
69
+ If you're developing a Nuxt module and need to add Vite plugins, you should use the [`addVitePlugin`](/docs/4.x/api/kit/builder#addviteplugin) utility:
70
+
71
+ ```ts [modules/my-module.ts]
72
+ import { addVitePlugin, defineNuxtModule } from '@nuxt/kit'
73
+ import yaml from '@rollup/plugin-yaml'
74
+
75
+ export default defineNuxtModule({
76
+ setup () {
77
+ addVitePlugin(yaml())
78
+ },
79
+ })
80
+ ```
81
+
82
+ ::important
83
+ If you're writing code that needs to access resolved Vite configuration, you should use the `config` and `configResolved` hooks _within_ your Vite plugin, rather than using Nuxt's `vite:extend`, `vite:extendConfig` and `vite:configResolved`.
84
+ ::
85
+
86
+ ::read-more{to="/docs/4.x/api/kit/builder#addviteplugin"}
87
+ Read more about `addVitePlugin` in the Nuxt Kit documentation.
88
+ ::
@@ -14,6 +14,10 @@ Nuxt have builders based on [Vite](https://github.com/nuxt/nuxt/tree/main/packag
14
14
 
15
15
  Extends the Vite configuration. Callback function can be called multiple times, when applying to both client and server builds.
16
16
 
17
+ ::warning
18
+ This hook is now deprecated, and we recommend using a Vite plugin instead with a `config` hook.
19
+ ::
20
+
17
21
  ### Usage
18
22
 
19
23
  ```ts twoslash
@@ -22,11 +22,9 @@ import { buildNuxt, loadNuxt } from '@nuxt/kit'
22
22
  async function getViteConfig () {
23
23
  const nuxt = await loadNuxt({ cwd: process.cwd(), dev: false, overrides: { ssr: false } })
24
24
  return new Promise((resolve, reject) => {
25
- nuxt.hook('vite:extendConfig', (config, { isClient }) => {
26
- if (isClient) {
27
- resolve(config)
28
- throw new Error('_stop_')
29
- }
25
+ nuxt.hook('vite:extend', (config) => {
26
+ resolve(config)
27
+ throw new Error('_stop_')
30
28
  })
31
29
  buildNuxt(nuxt).catch((err) => {
32
30
  if (!err.toString().includes('_stop_')) {
@@ -75,8 +75,8 @@ Hook | Arguments | Description
75
75
  `schema:beforeWrite` | `schema` | Called before writing the given schema.
76
76
  `schema:written` | - | Called after the schema is written.
77
77
  `vite:extend` | `viteBuildContext` | Allows extending Vite default context.
78
- `vite:extendConfig` | `viteInlineConfig, env` | Allows extending Vite default config.
79
- `vite:configResolved` | `viteInlineConfig, env` | Allows reading the resolved Vite config.
78
+ `vite:extendConfig` | `viteInlineConfig, env` | Allows extending Vite default config. **Deprecated.** We recommend adding a Vite plugin with a `config` hook.
79
+ `vite:configResolved` | `viteInlineConfig, env` | Allows reading the resolved Vite config. **Deprecated.** We recommend adding a Vite plugin with a `configResolved` hook.
80
80
  `vite:serverCreated` | `viteServer, env` | Called when the Vite server is created.
81
81
  `vite:compiled` | - | Called after Vite server is compiled.
82
82
  `webpack:config` | `webpackConfigs` | Called before configuring the webpack compiler.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nuxt/docs-nightly",
3
- "version": "4.2.0-29334442.191bcb7e",
3
+ "version": "4.2.0-29335081.002c92c6",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/nuxt/nuxt.git",