Skip to content

Extend cutting to bundle-emitted assets, not just publicDir copies #7

Description

@firejune

The vite plugin's reach is publicDir copies only: buildStart globs config.publicDir and takes the fragments, closeBundle overwrites outDir/<same relative path> (overwrite-only, never create — by design, so files a consumer's build deliberately removed stay removed).

Consequence: any asset that goes through the bundler itself — imported via an alias, emitted by Rollup/Vite as a hashed type: 'asset' file — is out of reach in principle. The hash renames the file but does not touch its bytes; it ships as a fully openable image. Consumers cannot fix this from outside the plugin.

Proposal: an opt-in that extends cutting to bundle output — in generateBundle, iterate emitted type: 'asset' files (filtered by the same include/exclude semantics), cut their headers, and key the fragment map by the emitted filename so the runtime can find the body it actually fetches.

Structurally this is the biggest coverage gap in the current design: everything else (formats, release APIs) refines what the plugin already reaches; this one decides what it can reach at all.

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

    enhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions