-
-
Notifications
You must be signed in to change notification settings - Fork 19
Unexpected Token from dependency CSS import #603
Description
Describe the regression
I have a dependency in an app that imports some fonts using require (so not sure if that's related to this?), but this is working fine under Vite 7 right now. In trying the Rolldown version though, it fails with:

Reproduction
https://stackblitz.com/edit/vitejs-vite-axp1eycg?file=src%2FApp.tsx
Expected Behavior
I would expect this to build just as it has before, with a deprecation warning or something in the event I need to be moving away from a certain style of code.
Actual Behavior
You can see the crash in the browser console of the Stackblitz repro. I mimic'd the dependency as concisely as I could to the real one we use (a design system library in the company).
Steps to Reproduce
You can flip between Vite ^7.0.0 to see it work and it crash with the simple change to the rolldown version, there are no special configurations that are altered in the Vite config either.
System Info
In the linked reproUsed Package Manager
pnpm
Logs
Click to expand!
Error: [31mError during dependency optimization:
[39mBuild failed with 2 errors:
[31m[PARSE_ERROR] Error:[0m Unexpected token
[38;5;246m╭[0m[38;5;246m─[0m[38;5;246m[[0m node_modules/.pnpm/@fontsource+material-icons@5.2.7/node_modules/@fontsource/material-icons/index.css:2:6 [38;5;246m][0m
[38;5;246m│[0m
[38;5;246m2 │[0m [38;5;249m@[0m[38;5;249mf[0m[38;5;249mo[0m[38;5;249mn[0m[38;5;249mt[0m-[38;5;249mf[0m[38;5;249ma[0m[38;5;249mc[0m[38;5;249me[0m[38;5;249m [0m[38;5;249m{[0m
[38;5;240m │[0m ┬
[38;5;240m │[0m ╰──
[38;5;246m───╯[0m
[31m[PARSE_ERROR] Error:[0m Unexpected token
[38;5;246m╭[0m[38;5;246m─[0m[38;5;246m[[0m node_modules/.pnpm/@fontsource+roboto-mono@5.2.8/node_modules/@fontsource/roboto-mono/index.css:2:6 [38;5;246m][0m
[38;5;246m│[0m
[38;5;246m2 │[0m [38;5;249m@[0m[38;5;249mf[0m[38;5;249mo[0m[38;5;249mn[0m[38;5;249mt[0m-[38;5;249mf[0m[38;5;249ma[0m[38;5;249mc[0m[38;5;249me[0m[38;5;249m [0m[38;5;249m{[0m
[38;5;240m │[0m ┬
[38;5;240m │[0m ╰──
[38;5;246m───╯[0m(copied from Stackblitz, which is not as clear as error image above but it's whining about @font-face in some CSS)
Validations
- Follow our Code of Conduct
- Read the Contributing Guidelines.
- Read the docs and the Rolldown-related guide.
- Check that there isn't already an issue that reports the same regression to avoid creating a duplicate.
- Check that this is a concrete regression. For Q&A open a GitHub Discussion or join our Discord Chat Server.
- The provided reproduction is a minimal reproducible example of the regression.