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

"Reflect.hasOwnMetadata" is not a function #4

Closed
carere opened this issue Jun 24, 2021 · 1 comment
Closed

"Reflect.hasOwnMetadata" is not a function #4

carere opened this issue Jun 24, 2021 · 1 comment

Comments

@carere
Copy link

carere commented Jun 24, 2021

Hello,

Thx for your work, it's a step further to enable typescript decorator in esbuild ;)

I still got the error Reflect.hasOwnMetadata is not a function. I added your plugin in my configuration for Esbuild (I am using Vite JS for bundling), so here is my vite.config.ts file.

import { defineConfig } from 'vite';
import reactRefresh from '@vitejs/plugin-react-refresh';
import NodeModulePolyfill from '@esbuild-plugins/node-modules-polyfill';
import NodeGlobalsPolyfill from '@esbuild-plugins/node-globals-polyfill';
import EsbuildTypescript from 'esbuild-plugin-tsc';

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [reactRefresh()],
  define: {
    'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV),
  },
  optimizeDeps: {
    esbuildOptions: {
      plugins: [
        EsbuildTypescript(),
        NodeModulePolyfill(),
        NodeGlobalsPolyfill(),
      ],
    },
  },
});

And here is my tsconfig.json

{
  "compilerOptions": {
    "target": "ESNext",
    "lib": ["DOM", "DOM.Iterable", "ESNext"],
    "allowJs": false,
    "skipLibCheck": false,
    "esModuleInterop": false,
    "allowSyntheticDefaultImports": true,
    "strict": true,
    "forceConsistentCasingInFileNames": true,
    "module": "ESNext",
    "moduleResolution": "Node",
    "resolveJsonModule": true,
    "isolatedModules": true,
    "noEmit": true,
    "jsx": "react",
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true
  },
  "include": ["./src"]
}

Do you have any idea why i still got an error ? I thought that your plugin would fix the problem of Typescript decorator.

Anyway, thanks again for your work ;)

Best regards,

@carere carere closed this as completed Jun 26, 2021
@jpike88
Copy link

jpike88 commented Aug 6, 2021

you closed this... any reason?

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

No branches or pull requests

2 participants