elysiajs / elysia

Ergonomic Framework for Humans
https://elysiajs.com
MIT License
10.27k stars 219 forks source link

`bun build --minify` does not allow libraries to integrate with Elysia #740

Open cybercoder-naj opened 3 months ago

cybercoder-naj commented 3 months ago

What version of Elysia.JS is running?

1.1.3

What platform is your computer?

Linux 6.6.32-1-lts x86_64 unknown

What steps can reproduce the bug?

  1. Clone the repo: git clone --single-branch --branch reproduction/build-minify https://github.com/cybercoder-naj/logestic
  2. Change directory: cd logestic.
  3. Build without minify: bun run build; and preview bun run preview. It works
  4. Build with minify: bun run build:minify; and preview bun run preview. It doesn't work

What is the expected behavior?

Minify should correctly bundle the library contents to integrate with Elysia.

What do you see instead?

Elysia app does not start when it is using the minified code.

Additional information

No response

remorses commented 2 months ago

This is probably related to aot mode not working with minification because some variable names are renamed

aot mode works by creating code and evaluating it at runtime (I would prefer Elysia make this feature disabled by default)