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

Support esbuild plugin onStart, onEnd, and onDispose callbacks #2771

Open
1 of 5 tasks
paperclover opened this issue Apr 29, 2023 · 5 comments
Open
1 of 5 tasks

Support esbuild plugin onStart, onEnd, and onDispose callbacks #2771

paperclover opened this issue Apr 29, 2023 · 5 comments
Labels
bundler Something to do with the bundler enhancement New feature or request

Comments

@paperclover
Copy link
Member

paperclover commented Apr 29, 2023

Currently, we do not implement these three callbacks, but instead throw an error pointing to this issue.

They are very trivial to implement in a non-reloading setting, and mostly simple in a watch/hmr build. Usage is documented here.

Keep this issue open until:

@paperclover paperclover added enhancement New feature or request bundler Something to do with the bundler labels Apr 29, 2023
@ComLock ComLock mentioned this issue Oct 6, 2023
53 tasks
@Enalmada
Copy link

I am creating an npm module that requires 'use client'; directive to remain at the top of the file after build. bun is stripping it out right now.

It looks like esbuild is recommending the banner feature for equivalent functionality. I believe I could make a bun plugin to put 'use client' back this but need onEnd supported. Thank you for implementing when it makes sense.

@HuakunShen
Copy link

What's the status of this?
Need the onEnd callback.

@BjornTheProgrammer
Copy link
Contributor

Notably, onEnd could also help fix #15033 by creating a plugin that outputs the relevant information to the end user, as onEnd should have access to metafiles.

@mProjectsCode
Copy link

mProjectsCode commented Nov 26, 2024

onEnd missing currently blocks esbuild-svelte 0.9.0 from working.

# Unhandled error between tests
-------------------------------
263 |       });
264 |       build.onLoad({ filter: FAKE_CSS_FILTER, namespace: "fakecss" }, ({ path }) => {
265 |         const css = cssCode.get(path);
266 |         return css ? { contents: css, loader: "css", resolveDir: dirname(path) } : null;
267 |       });
268 |       build.onEnd(() => {
                  ^
TypeError: build.onEnd is not a function. (In 'build.onEnd(() => {
          if (!options)
            options = {};
          if (options.cache === void 0)
            options.cache = !0;
        })', 'build.onEnd' is undefined)
      at setup (***/node_modules/esbuild-svelte/dist/index.js:268:13)
      at ***/tests/__preload__/svelteLoader.ts:5:1

@BjornTheProgrammer
Copy link
Contributor

I forgot to put it here, but I'm actively developing the onEnd hook. I can put up the branch if anyone else is interested in helping.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bundler Something to do with the bundler enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

5 participants