denoland / deno

A modern runtime for JavaScript and TypeScript.
https://deno.com
MIT License
94.01k stars 5.23k forks source link

Deno Compile do not use config file #15119

Open kadiryazici opened 2 years ago

kadiryazici commented 2 years ago

When we compile our deno app to an executable, it compiles it without deno.json options. I needed emitDecoratorMetadata in my project and it works fine with config file but when I compile it, it does not work.

kitsonk commented 2 years ago

Can you provide a more complete reproduction and what is specifically not working?

With deno compile all the sources are generated based on the compiler options at the time they are generated and inlined in the binary. Once that is done, the compiler options have no further impact, as the compiled binary does not interpret or emit code, so there is nothing directly generated by the resulting binary that emitDecoratorMetadata would impact.

kadiryazici commented 2 years ago

@kitsonk I use a package called alosaur and it is decorators based library, to use it we need to enable emitDecoratorMetadata. With deno run it works but when I compile the app it gives error about metadata.

You can find the source code here https://github.com/kadiryazici/deno-crud

Currently I use deno bundle app.ts bundle.js && deno compile bundle.js to make it work as single executable.

aniruddha-adhikary commented 1 year ago

I can confirm, having the same issue with emitDecoratorMetadata

aniruddha-adhikary commented 1 year ago

@kitsonk I use a package called alosaur and it is decorators based library, to use it we need to enable emitDecoratorMetadata. With deno run it works but when I compile the app it gives error about metadata.

You can find the source code here https://github.com/kadiryazici/deno-crud

Currently I use deno bundle app.ts bundle.js && deno compile bundle.js to make it work as single executable.

Worked for me!

bartlomieju commented 1 year ago

I believe this is now fixed, can you folks repeat the problem with latest Deno version (1.29.1)?

sirikon commented 1 year ago

I still have the same problem with Deno 1.29.1. In my case I'm using tsyringe and reflect-metadata, and it doesn't work when running deno compile directly. I still rely on @kadiryazici 's trick of bundling-and-compiling.

wave-light commented 10 months ago

This issue is still present using Deno 1.38.2, using InversifyJS and reflect-metadata.

yasaichi commented 8 months ago

In Deno 1.39.0, still facing the same issue with NestJS, which internaly uses reflect-metadata. ref. https://github.com/nestjs/nest/blob/18335ffa9d53d7efd4f1529761f3539f035aaa79/packages/core/index.ts#L7