Skip to content

Temporary sourcemaps support #12828

@ikenfin

Description

@ikenfin

Description

As a developer of vite-plugin-sentry i've seen many feature requests from users to add option to delete sourcemaps after they become uploaded to external service (Sentry in my case). issue

While there are exist some workarounds, i think better solution would control sourcemaps generation and cleaning processes at Vite level.

Suggested solution

I think it would be perfect to have some option to generate sourcemaps temporary.

// Example of config:
build: {
  sourcemap: 'hidden',
  sourcemapTemporary: true // by default false 
}

When sourcemapTemporary is false - there are no any changes in Vite behavior.
When sourcemapTemporary is true - Vite runs as always. At the end of bundling process, Vite removes generated sourcemaps (option is ignored if sourcemap was false).

Alternative

For now there are several possible workarounds (from better to worst):

  1. Using CI like Jenkins to skip sourcemap files
  2. Manual removing by using rimraf or similar tool (vite build && rimraf dist/**/*.map)
  3. Providing plugin level option to remove sourcemaps (most sourcemap uploaders implemented in this manner at the moment).

Additional context

No response

Validations

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions