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

feat: Leverage esbuild CLI commands #66

Open
Leokuma opened this issue Aug 20, 2024 · 1 comment
Open

feat: Leverage esbuild CLI commands #66

Leokuma opened this issue Aug 20, 2024 · 1 comment

Comments

@Leokuma
Copy link

Leokuma commented Aug 20, 2024

Thank you for this very underrated project.

Is your feature request related to a problem? Please describe
The main motivation for this issue is the same as #45, but I have more points to bring to the table.

I use the bundled version of Lit. I import that file in every Lit component I have, and packup build ends up adding the entire Lit bundle to every component.

Describe the solution you'd like
I'd like Packup to have an option to just transpile TS, without bundling. That would solve the problem for me.

Describe alternatives you've considered
Since esbuild supports transpiling without bundling, could Packup leverage esbuild commands? I was wondering if Packup could just forward to esbuild whatever commands Packup receives via CLI.

By doing that, we would automatically give the user the option to minify, mangle, add a footer, limit line length, tweak path resolution and everything else that esbuilds supports. Whenever esbuild adds a new feature, it could be easily added to Packup as well, and the docs would always be up to date because the user could refer to esbuild's docs.

So packup build would be become packup build --bundle (because esbuild takes the --bundle arg). And immediately we would support esbuild flags like --minify, --keep-names, --mangle-props, --minify-whitespace and others. Same thing for packup serve.

Caveats

  • I guess not all esbuild flags will work OOTB (e.g. code splitting). We could intercept those flags and inform the user that they are not supported yet.
  • Packup's own CLI args would be mixed with esbuild's args, which means they probably shouldn't have the same names. We could prefix Packup's args to avoid naming collisions with esbuild.

Let me know if you like the idea 👍.

@kt3k
Copy link
Owner

kt3k commented Aug 23, 2024

I'm not actively developing this project anymore. I'd accept small non-breaking PRs (like adding --no-bundle option), but if you like to see more fundamental changes (like supporting many of esbuild options) then I'd recommend you would start your own project (maybe forking this project)

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

Successfully merging a pull request may close this issue.

2 participants