Skip to content

Only the esbuild entry point cleans anything, so publish only that one #73

Description

@shellicar

The package publishes an entry point per bundler through unplugin, and only /esbuild does anything. The rest produce a plugin with a name and an enforce and no hook that could run the cleanup, because the factory returns its work under the esbuild key, which only the esbuild adapter reads.

/nuxt and /astro are hand-written here and delegate to /vite and /webpack, so they inherit the same nothing.

These are in the exports map, so they can be imported. What they cannot do is have an effect, which is why removing them breaks nobody: an import that does nothing cannot be depended on.

Making them work is possible instead. unplugin's writeBundle is a generic hook every bundler receives, and it fires after output is written. It takes no arguments though, so the output directory and the set of built files would each have to come from somewhere per bundler. That is a real feature, and it would mean deleting files under bundlers this plugin has never been run against.

The readme already says these do nothing rather than showing a vite example that never removed a file, so this closes the gap rather than the confusion.

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

    pkg: build-cleanBuild plugin — cleans unused output files

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions