Skip to content

vite-rolldown removes @vite-ignore comments #21950

@eddeisling

Description

@eddeisling

Describe the regression

Starting 7.1.8, vite-rolldown started to remove comments even when minify: false is set. In my case, I have comments like these in my library code, and I need to ship my library with them.

/* @vite-ignore */
/* webpackIgnore: true */

in 7.1.7, comments were preserved when minify: false

Reproduction

https://stackblitz.com/edit/vitejs-rolldown-vite-jqpqhd91?file=vite.config.js

Expected Behavior

When minify: false comments are not removed

Actual Behavior

Comments are removed

Steps to Reproduce

  1. run build in 7.1.8 and see dist/main.js - no comments
  2. run build in 7.1.7 and see dist/main.js - comments preserved

System Info

System:
    OS: Linux 5.0 undefined
    CPU: (8) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
    Memory: 0 Bytes / 0 Bytes
    Shell: 1.0 - /bin/jsh
  Binaries:
    Node: 20.19.1 - /usr/local/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 10.8.2 - /usr/local/bin/npm
    pnpm: 8.15.6 - /usr/local/bin/pnpm
  npmPackages:
    rolldown-vite:  7.1.8

Used Package Manager

npm

Logs

No response

Validations

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug: upstreamBug in a dependency of Vitep3-minor-bugAn edge case that only affects very specific usage (priority)regressionThe issue only appears after a new release

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions