#5685·rollup

Rollup causes syntax error by changing valid code to invalid code (import attributes `with` -> `assert`)

Author: or9Created Sep 27, 2024Updated Mar 20, 2026
Labelst¹ 🐞 bugt⁸ ⋅ triage

Rollup Version

4.22.5

Operating System (or Browser)

Google Chrome 128.0.6613.84 (Official Build) (arm64)

Node Version (if applicable)

v20.10.0

Link To Reproduction

repl

Expected Behaviour

Web application should work.

Input:    import mainStyles from "../css/main.css" with { type: "css" }; Output: import mainStyles from "../css/main.css" with { type: "css" };

The expectation is that build tools should build, not change the functionality of code. If it is changing with to assert, then what else is it changing? Given the constantly and rapidly evolving Javascript capabilities and support tables, it seems absurd for a build tool to try to keep up with everything.

image

Actual Behaviour

Web application does not work. (Syntax error thrown)

Input:    import mainStyles from "../css/main.css" with { type: "css" }; Output: import mainStyles from "../css/main.css" assert { type: "css" };

image