-
Notifications
You must be signed in to change notification settings - Fork 114
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
decorators not running with esbuild #2509
Comments
What version of Related: evanw/esbuild#104 |
Thanks for getting back, sorry was about to post up and say we managed to get it sorted. Not entirely sure how, but yes I think there was some legacy stuff getting in the way and we were trying to build out to esm and run in lambda which I think it wasn't happy about. We did still need to use the esbuil tsc plugin to get it to pickup the dependancy injection though. So the resulting working config if it's of use to anyone is tsconfig {
"compilerOptions": {
"experimentalDecorators": true,
"module": "esnext",
"target": "esnext",
"lib": [
"dom",
"esnext",
"esnext.asynciterable"
],
"noImplicitAny": false,
"allowSyntheticDefaultImports": true,
"ignoreDeprecations": "5.0",
"moduleResolution": "node",
"removeComments": true,
"emitDecoratorMetadata": true,
"sourceMap": true,
"inlineSources": true,
"importHelpers": true,
"esModuleInterop": true,
"declaration": true,
"sourceRoot": "/",
"outDir": "./dist",
"rootDir": "./src",
"baseUrl": "./"
},
"include": ["src/**/*.ts", "src/**/*.tsx", "src/**/*.js", "src/**/*.mjs", "src/**/*.ejs", "src/**/*.graphql"],
"exclude": ["node_modules"]
} esbuild.config.js export default async (serverless) => {
const devMode = process.env.NODE_ENV === 'development' || !process.env.NODE_ENV
return {
color: true,
metafile: true,
logLevel: 'info',
outdir: serverless ? undefined : 'dist',
outExtension: { '.js': '.js' },
entryPoints: ['src/index.ts'],
bundle: true,
minify: !devMode,
sourcemap: devMode,
sourcesContent: devMode,
format: 'cjs', //needs to be cjs for lambda, but local dev environment can stay as esm/module
target: 'node20',
platform: 'node',
loader: {
'.graphql': 'text',
'.gql': 'text',
'.html': 'text'
},
resolveExtensions: ['.ts', '.js', '.mjs', '.cjs', '.graphql'],
external: [
'@aws-sdk/*',
'dtrace-provider',
'reflect-metadata',
'graphql*',
'@escape.tech/*',
'@envelop/*'
],
plugins: [
esbuildPluginTsc({ force: true }),
...copyPlugin
],
define: {
'global': 'global',
'Reflect.metadata': 'Reflect.metadata'
}
}
} |
Describe the bug
Apologies I'm not 100% sure this is a bug, but I've tried all the usual stuff relating to esbuild with decorators and with still doesn't work. So maybe just looking for some guidnace as to what I'm missing as I've searched all over and can't find much in the way of questions etc related to this stuff
To Reproduce
use esbuild to build your module
(will try and get a sandbox up)
Expected behavior
dependancy injector decorators inject the depancies
Environment:
@graphql-modules/...
: ^2.4.0",Additional context
bable
tsconfig
esbuild
The text was updated successfully, but these errors were encountered: