@nuxt/docs-nightly 4.4.0-29548611.515aeeef → 4.4.0-29548729.25b61ad4
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.
|
@@ -773,7 +773,9 @@ export default defineNuxtConfig({
|
|
|
773
773
|
|
|
774
774
|
## decorators
|
|
775
775
|
|
|
776
|
-
This option enables
|
|
776
|
+
This option enables decorator syntax across your entire Nuxt/Nitro app.
|
|
777
|
+
|
|
778
|
+
When using the Vite builder (default), decorators are lowered via [Babel](https://babeljs.io/) using [`@babel/plugin-proposal-decorators`](https://babeljs.io/docs/babel-plugin-proposal-decorators). When using the webpack or rspack builders, decorators are lowered via [esbuild](https://github.com/evanw/esbuild/releases/tag/v0.21.3).
|
|
777
779
|
|
|
778
780
|
For a long time, TypeScript has had support for decorators via `compilerOptions.experimentalDecorators`. This implementation predated the TC39 standardization process. Now, decorators are a [Stage 3 Proposal](https://github.com/tc39/proposal-decorators), and supported without special configuration in TS 5.0+ (see https://github.com/microsoft/TypeScript/pull/52582 and https://devblogs.microsoft.com/typescript/announcing-typescript-5-0-beta/#decorators).
|
|
779
781
|
|
|
@@ -793,6 +795,24 @@ export default defineNuxtConfig({
|
|
|
793
795
|
})
|
|
794
796
|
```
|
|
795
797
|
|
|
798
|
+
When using the Vite builder or the Nitro server build, you will need to install additional Babel packages as dev dependencies:
|
|
799
|
+
|
|
800
|
+
::code-group
|
|
801
|
+
```bash [npm]
|
|
802
|
+
npm install -D @babel/plugin-proposal-decorators @babel/plugin-syntax-jsx
|
|
803
|
+
```
|
|
804
|
+
```bash [pnpm]
|
|
805
|
+
pnpm add -D @babel/plugin-proposal-decorators @babel/plugin-syntax-jsx
|
|
806
|
+
```
|
|
807
|
+
```bash [yarn]
|
|
808
|
+
yarn add -D @babel/plugin-proposal-decorators @babel/plugin-syntax-jsx
|
|
809
|
+
```
|
|
810
|
+
::
|
|
811
|
+
|
|
812
|
+
::tip
|
|
813
|
+
Nuxt will prompt you to install these automatically if they are not already present.
|
|
814
|
+
::
|
|
815
|
+
|
|
796
816
|
```ts [app/app.vue]
|
|
797
817
|
function something (_method: () => unknown) {
|
|
798
818
|
return () => 'decorated'
|