Skip to content

Feature Request: Option to cleanup injected sources in build output #64

@cinderblock

Description

@cinderblock

It would be nice, when inject: true, to not have the source files littered around still. One option would be to use an alternate folder, but why bother?

I wrote a quick "plugin" to do this:

{
  name: 'Cleanup Plugin',
  setup(build) {
    build.onEnd(res =>
      Promise.all(
        Object.keys(res.metafile?.outputs ?? {}).map(file =>
          unlink(file).catch(e => logger.warn(`Failed to clean up ${file}: ${e.message}`)),
        ),
      ).then(() => {}),
    );
  },
},

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

    Issue actions