Nuxi doesn't work with TS decorators
Environment
- Operating System: Win10
- Node Version: v18.15.0
- Nuxt Version: 2.17.1
- Nitro Version: 2.5.2
- Package Manager: [email protected]
- Builder: vite, webpack
- User Config: bridge, typescript, nitro
- Runtime Modules: -
- Build Modules: (), @nuxt/[email protected]
Reproduction
My project is private.
Describe the bug
I use [email protected] with [email protected] and after adding nuxt-bridge with nuxi i have issue
But if i use config
buildModules: [
'@nuxt/typescript-build'
],
bridge: {
typescript: false,
},
and run with npm run nuxt all work fine
Additional context
tsconfig.json
{
"extends": "./.nuxt/tsconfig.json",
"vueCompilerOptions": {
"target": 2.7,
},
"compilerOptions": {
"module": "esnext",
"target": "es2018",
"moduleResolution": "node",
"strict": true,
"lib": [
"ESNext",
"ESNext.AsyncIterable",
"DOM",
"DOM.Iterable"
],
"esModuleInterop": true,
"allowJs": true,
"sourceMap": true,
"noEmit": true,
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"strictPropertyInitialization": false,
"skipLibCheck": true,
"baseUrl": ".",
"paths": {
"~/*": [
"./*"
],
"@/*": [
"./*"
]
},
"types": [
"reflect-metadata",
"@nuxt/types",
"@types/node",
"@nuxtjs/axios",
"@nuxtjs/auth-next",
],
},
"include": [
"./**/*"
],
"exclude": [
"node_modules",
".nuxt",
"dist"
]
}
Logs
No response
Some issue https://github.com/nuxt/nuxt/issues/14126
With vite have some issue https://github.com/vitejs/vite/issues/13736
I think, it can help to resolve this issue https://stackoverflow.com/questions/52557878/babel-7-inversify-4-webpack-4-unexpected-character-on-inject
Is it still open I have same issue after upgrading nuxt from 3.2.3 to 3.8?
The latest version seems to solve this problem by setting the experimentalDecorators option in tsconfig.
https://stackblitz.com/edit/github-yw5f4n
@wattanx when you run yarn build it gives errors. I think the issue still persists.
Hi, I also encountered this issue today and the problem is related to TS decorators in general. Setting experimentalDecorators in tsconfig has no effect, downgrading nuxi and nuxt-bridge does not help either.
Sorry, you reproduced the environment incorrectly. It works when configured as follows.
https://stackblitz.com/edit/github-yw5f4n?file=nuxt.config.ts
import { defineNuxtConfig } from '@nuxt/bridge';
export default defineNuxtConfig({
ssr: false,
bridge: {
vite: true,
nitro: true,
},
vite: {
esbuild: {
tsconfigRaw: {
compilerOptions: {
experimentalDecorators: true
}
}
}
}
});