bridge icon indicating copy to clipboard operation
bridge copied to clipboard

Nuxi doesn't work with TS decorators

Open BulatSa opened this issue 2 years ago • 4 comments

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 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 avatar Aug 18 '23 11:08 BulatSa

Some issue https://github.com/nuxt/nuxt/issues/14126

BulatSa avatar Aug 18 '23 12:08 BulatSa

With vite have some issue https://github.com/vitejs/vite/issues/13736

BulatSa avatar Aug 18 '23 12:08 BulatSa

I think, it can help to resolve this issue https://stackoverflow.com/questions/52557878/babel-7-inversify-4-webpack-4-unexpected-character-on-inject

BulatSa avatar Nov 28 '23 08:11 BulatSa

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

WojciechxFalkowski avatar Dec 11 '23 08:12 WojciechxFalkowski

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

wattanx avatar Apr 04 '24 14:04 wattanx

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

joshuagauci avatar Apr 11 '24 11:04 joshuagauci

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.

Dmoulart avatar May 02 '24 09:05 Dmoulart

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

wattanx avatar May 02 '24 13:05 wattanx