Skip to content

feat(bundle, unstable): bundling backed by esbuild#29470

Merged
nathanwhit merged 50 commits intodenoland:mainfrom
nathanwhit:deno-bundle-esbuild
Jun 7, 2025
Merged

feat(bundle, unstable): bundling backed by esbuild#29470
nathanwhit merged 50 commits intodenoland:mainfrom
nathanwhit:deno-bundle-esbuild

Conversation

@nathanwhit
Copy link
Member

@nathanwhit nathanwhit commented May 27, 2025

todo:

  • cleanup cli, decide what flags we want to commit to
  • decide what to do about node addons - (you can mark them external via --external)
  • move esbuild_rs to the denoland org
  • figure out the dynamic require issue
  • figure out how to test this
  • clean up / revert all the random changes

Copy link
Member Author

@nathanwhit nathanwhit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

self review

@nathanwhit nathanwhit marked this pull request as ready for review May 30, 2025 21:00
@nathanwhit nathanwhit changed the title bundling backed by esbuild feat(bundle, unstable): bundling backed by esbuild May 30, 2025
@nathanwhit nathanwhit force-pushed the deno-bundle-esbuild branch from 64cffeb to da21da5 Compare June 3, 2025 16:39

{
tokio::spawn(async move {
let res = esbuild.wait_for_exit().await;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it ok to have this in a tokio task? If Deno errors, will it kill the esbuild process?

let pin = pin.await?;
Ok(Some((pin.code.as_bytes().to_vec(), loader)))
}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmmm... might be nice if we figured out how to remove deno_core from here.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO this is fine since we use deno_core::ModuleLoader here

@nathanwhit nathanwhit enabled auto-merge (squash) June 7, 2025 18:40
Copy link
Member

@bartlomieju bartlomieju left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's land and keep iterating

Comment on lines +1932 to +1936
deno bundle https://deno.land/std/examples/colors.ts colors.bundle.js

If no output file is given, the output is written to standard output:

deno bundle https://deno.land/std/examples/colors.ts
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's improve this in a follow up - it's probably better to give examples of bundling code on disk than an http specifier


{
tokio::spawn(async move {
let res = esbuild.wait_for_exit().await;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you verify it after all?

let pin = pin.await?;
Ok(Some((pin.code.as_bytes().to_vec(), loader)))
}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO this is fine since we use deno_core::ModuleLoader here

@nathanwhit nathanwhit merged commit 7a837f9 into denoland:main Jun 7, 2025
18 checks passed
@waterblower
Copy link

super excited about this PR!

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 this pull request may close these issues.

4 participants