-
Notifications
You must be signed in to change notification settings - Fork 48
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
emitDecoratorMetadata workaround #2
Comments
Hi @yassinebridi , to use this with nestjs you have to set the server: "nest" under the hood for nest, this plugin is using please try that and let me know if it works. Cheers. |
@axe-me That's what i did with the ts transplier set to |
@yassinebridi can you please provide the error log? Esbuild won't work for nest. |
The error log isn't really helpful, i get this:
This is my import { VitePluginNode } from 'vite-plugin-node';
/**
* @type {import('vite').UserConfig}
*/
const config = {
plugins: [
...VitePluginNode({
server: 'nest',
appPath: './src/main.ts',
port: 3000,
tsCompiler: 'swc',
}),
],
};
export default config; And this is my import { NestFactory } from '@nestjs/core';
import { AppModule } from './app.module';
export const createViteNodeApp = NestFactory.create(AppModule); And this is my {
"dependencies": {
"@anatine/esbuild-decorators": "^0.2.7",
"@nestjs/common": "^7.6.15",
"@nestjs/config": "^0.6.3",
"@nestjs/core": "^7.6.15",
"@nestjs/graphql": "^7.10.3",
"@nestjs/jwt": "^7.2.0",
"@nestjs/passport": "^7.1.5",
"@nestjs/platform-express": "^7.6.15",
"@prisma/client": "^2.20.1",
"@vp/common": "*",
"apollo-server-express": "^2.22.2",
"bcrypt": "^5.0.1",
"chalk": "^4.1.0",
"chokidar": "^3.5.1",
"cookie-parser": "^1.4.5",
"esbuild": "^0.11.10",
"esbuild-node-externals": "^1.1.0",
"graphql": "^15.5.0",
"graphql-redis-subscriptions": "^2.3.1",
"graphql-type-json": "^0.3.2",
"ioredis": "^4.26.0",
"lodash": "^4.17.21",
"passport": "^0.4.1",
"passport-facebook": "^3.0.0",
"passport-google-oauth20": "^2.0.0",
"passport-jwt": "^4.0.0",
"pg": "^8.5.1",
"prisma-nestjs-graphql": "^11.0.3",
"reflect-metadata": "^0.1.13",
"remove": "^0.1.5",
"rimraf": "^3.0.2",
"rxjs": "^6.6.7"
},
"devDependencies": {
"@anatine/esbuild-decorators": "^0.2.7",
"@nestjs/cli": "7.5.4",
"@nestjs/schematics": "^7.3.1",
"@types/express": "^4.17.11",
"@types/graphql-type-json": "^0.3.2",
"@types/ioredis": "^4.22.3",
"@types/node": "^14.14.37",
"@types/passport-jwt": "^3.0.5",
"@typescript-eslint/eslint-plugin": "^4.21.0",
"@typescript-eslint/parser": "^4.21.0",
"chalk": "^4.1.0",
"chokidar": "^3.5.1",
"esbuild": "^0.11.10",
"esbuild-node-externals": "^1.1.0",
"eslint": "^7.24.0",
"eslint-config-prettier": "^8.1.0",
"eslint-plugin-prettier": "^3.3.1",
"prettier": "^2.2.1",
"prisma": "^2.20.1",
"ts-loader": "^8.1.0",
"ts-node": "^9.1.1",
"tsconfig-paths": "^3.9.0",
"typescript": "^4.2.4",
"vite": "^2.1.5",
"vite-plugin-node": "^0.0.7"
}
} |
@yassinebridi I just tried the plugin on a freshly created nest project. Everything works fine for me. Can you please create a minimum repro for this if possible? |
@axe-me While using yarn doesn't throw any descriptive errors, using npm gives this:
I'm not sure if something needs to be compiled for each CPU architecture. This is my processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 58
model name : Intel(R) Core(TM) i3-3110M CPU @ 2.40GHz
stepping : 9
microcode : 0x21
cpu MHz : 1909.582
cache size : 3072 KB
physical id : 0
siblings : 4
core id : 0
cpu cores : 2
apicid : 0
initial apicid : 0
fpu : yes
fpu_exception : yes
cpuid level : 13
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer xsave avx f16c lahf_lm cpuid_fault epb pti ssbd ibrs ibpb stibp tpr_shadow vnmi flexpriority ept vpid fsgsbase smep erms xsaveopt dtherm arat pln pts md_clear flush_l1d
vmx flags : vnmi preemption_timer invvpid ept_x_only flexpriority tsc_offset vtpr mtf vapic ept vpid unrestricted_guest
bugs : cpu_meltdown spectre_v1 spectre_v2 spec_store_bypass l1tf mds swapgs itlb_multihit
bogomips : 4790.34
clflush size : 64
cache_alignment : 64
address sizes : 36 bits physical, 48 bits virtual
power management:
processor : 1 Can you check if this package is working on another CPU architecture. |
Without see a reproduce I cant really tell what's the issue is. However, since you are using graphQL, I guess it could be related to the circular dependency problem in Vite. see : vitejs/vite#2491 and vitejs/vite#2258 until that gets resolved, I cant do much in the plugin. |
No my last comment was about a completely new NestJS project, just go scaffolded with the Nest CLI, no GraphQL. From what i can deduct from searching for that error, it seems that a package used in |
Interesting... |
Yep you are right, it's swc's issue. |
@yassinebridi Is that code run with What kind of args, are you referring to in this code? @Query(() => String)
getOneSettings(@Args() name: string) {
return name;
} Is it working with getOneSettings(@Args("name") name: string) {
return name;
} ? If not, what error it throws? Isn't that @ArgsType()
class GetOneSettingsArgs {
@Field()
name: string;
}
// .... in resolver
getOneSettings(@Args() withName: GetOneSettingArgs) {
return withName.name; // as string
} Sorry for that amount of questions, but I want to make sure that is really fault of @axe-me speed of your plugin makes mine heart grow :P thank you |
Yeah, I should have check if it's closed already before posting questions. |
I opened an issue in swc's repo, i really hope there is a quick fix for this issue, because i can't wait to use this package too, the speed difference in insanely huge. |
First of all thank you for this wonderful package, the speed difference is insane.
It almost complied for me, until this error occured
I'm not sure if this is due to esbuild not supporting
emitDecoratorMetadata
.This problem occurs exactly with this kind of code:
If i remove the
@Args() name: string
it works properly.@Args
is coming from@nestjs/graphql
The text was updated successfully, but these errors were encountered: