Skip to content

fix: include content in css sourcemap when extracting #1627

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 4, 2025

Conversation

stipsan
Copy link
Contributor

@stipsan stipsan commented Jul 31, 2025

Hi 👋

Without source map contents included (which is the default behavior of rollup sourcemaps) it makes them less useful.

For example if you explore the app.css and app.css.map for the fixtures/react-library-example workspace on [https://evanw.github.io/source-map-visualization] the mappings lead to empty files:
image

With this PR the mappings now preserve the CSS that were initially omitted:

image

Richer sourcemaps are especially useful when vanilla extract is the first step, and later on lightningcss, cssnano or postcss is operating on the extracted CSS asset. In those scenarios it's helpful to know what the CSS looked like before it was optimized and possibly deduped 😌

Thanks so much for #1604 and #1616 btw. At Sanity we've decided to move away entirely from styled-components; vanilla-extract is shaping up to become its replacement. Since our tooling is leaning heavily on rollup, with the long term goal of moving to rolldown, these recent improvements were helpful and appreciated ❤

Copy link

changeset-bot bot commented Jul 31, 2025

🦋 Changeset detected

Latest commit: 28e293e

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@vanilla-extract/rollup-plugin Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@stipsan stipsan force-pushed the rollup-sourcemaps branch from 895de12 to 28e293e Compare July 31, 2025 20:56
Copy link
Contributor

@askoufis askoufis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fix! Appreciate the example and explanation.

@askoufis askoufis enabled auto-merge (squash) August 4, 2025 11:04
@askoufis askoufis merged commit 2fcf8e8 into vanilla-extract-css:master Aug 4, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants