Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nuxi doesn't work with TS decorators #882

Closed
BulatSa opened this issue Aug 18, 2023 · 8 comments
Closed

Nuxi doesn't work with TS decorators #882

BulatSa opened this issue Aug 18, 2023 · 8 comments

Comments

@BulatSa
Copy link

BulatSa commented Aug 18, 2023

Environment

  • Operating System: Win10
  • Node Version: v18.15.0
  • Nuxt Version: 2.17.1
  • Nitro Version: 2.5.2
  • Package Manager: npm@8.19.4
  • Builder: vite, webpack
  • User Config: bridge, typescript, nitro
  • Runtime Modules: -
  • Build Modules: (), @nuxt/bridge@3.0.0-28200790.d820607

Reproduction

My project is private.

Describe the bug

I use inversify@6.0.1 with TS@5.1.2 and after adding nuxt-bridge with nuxi i have issue
image
image

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

@BulatSa BulatSa changed the title Nuxi does't work with inversify Nuxi doesn't work with inversify Aug 18, 2023
@BulatSa BulatSa changed the title Nuxi doesn't work with inversify Nuxi doesn't work with TS decorators Aug 18, 2023
@BulatSa
Copy link
Author

BulatSa commented Aug 18, 2023

Some issue nuxt/nuxt#14126

@BulatSa
Copy link
Author

BulatSa commented Aug 18, 2023

With vite have some issue
vitejs/vite#13736

@BulatSa
Copy link
Author

BulatSa commented Nov 28, 2023

@WojciechxFalkowski
Copy link

Is it still open I have same issue after upgrading nuxt from 3.2.3 to 3.8?

@wattanx
Copy link
Collaborator

wattanx commented Apr 4, 2024

The latest version seems to solve this problem by setting the experimentalDecorators option in tsconfig.
https://stackblitz.com/edit/github-yw5f4n

@wattanx wattanx closed this as completed Apr 4, 2024
@gaucj-t
Copy link

gaucj-t commented Apr 11, 2024

@wattanx when you run yarn build it gives errors. I think the issue still persists.
Screenshot 2024-04-11 at 13 03 24

@Dmoulart
Copy link

Dmoulart commented May 2, 2024

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.

@wattanx
Copy link
Collaborator

wattanx commented May 2, 2024

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
        }
      }
    }
  }
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants