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

Is there a way to get the result of esbuild when using the buildapi? #1082

Open
1111mp opened this issue Feb 9, 2024 · 1 comment
Open

Comments

@1111mp
Copy link

1111mp commented Feb 9, 2024

function build(_options: Options): Promise<void>

I've read the tsup documentation carefully, but still haven't found a way to read the result of esbuild. The closest method so far is to obtain the code string through the renderChunk method of plugin.

type RenderChunk = (this: PluginContext, code: string, chunkInfo: ChunkInfo) => MaybePromise<{
    code: string;
    map?: object | string | SourceMap$1 | null;
} | undefined | null | void>;

type Plugin = {
    name: string;
    esbuildOptions?: ModifyEsbuildOptions;
    buildStart?: BuildStart;
    renderChunk?: RenderChunk;
    buildEnd?: BuildEnd;
};

It's also possible that I missed some important documentation by mistake. If there is already a way to do this please feel free to correct me. Thanks. 🌹

Get whether the build method can be supported to return the result of esbuild, like this:

import { type BuildResult } from "esbuild";

function build(_options: Options): Promise<BuildResult[]>;

If possible I would like to submit a PR to support this feature. Of course there may be a better way, please feel free to let me know. Thanks.

Upvote & Fund

  • We're using Polar.sh so you can upvote and help fund this issue.
  • We receive the funding once the issue is completed & confirmed by you.
  • Thank you in advance for helping prioritize & fund our backlog.
Fund with Polar
@mayank1513
Copy link

You can use esbuildPlugins to get the build outputs.

Check out esbuild-plugin-react18 For an example.

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

No branches or pull requests

2 participants