Skip to content

Support for esbuild with Deno CLI #1913

Closed
@Xeevis

Description

@Xeevis

Hello,
I love esbuild and I love Deno. But while esbuild works flawlessly when called inside a Deno script, I'd love to have it working with stdin & CLI. This would allow esbuild to be used on any output with a simple one-liner.

Basically I'm trying to "Denoify" this Node call (--version for demonstration)

npx esbuild --version

But this call will not produce any output

deno run --allow-read "https://deno.land/x/esbuild/mod.js" --version

Now if I want to use esbuild with Deno CLI, I have to go through this hoop.
deno run --allow-read build.ts

import * as esbuild from "https://deno.land/x/esbuild/mod.js";
await Deno.stdout.write(new TextEncoder().encode(esbuild.version));

But as demonstrated by examples, it should theoretically be possible to make esbuild module work in CLI?

$> deno run https://deno.land/std@0.120.0/examples/flags.ts --minify --outfile test.css
{ _: [], minify: true, outfile: "test.css" }

Of course real-world usage would be to pipe CSS/JS/TS to esbuild for transforming or minification. Any thoughts? Thanks in advance.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @Xeevis

        Issue actions

          Support for esbuild with Deno CLI · Issue #1913 · evanw/esbuild