tailwindcss icon indicating copy to clipboard operation
tailwindcss copied to clipboard

Vite: Fix issues when loading files via static asset queries

Open philipp-spiess opened this issue 1 year ago • 1 comments

Fixes: #14558

This PR fixes an issue where our Vite plugin would crash when trying to load stylesheets via certain static asset query parameters:

import raw from './style.css?raw'
import url from './style.css?url'

The proper behavior for our extension is to not touch these file at all. The ?raw identifier should never transform anything and the ?url one will emit a module which points to the asset URL. However, if that URL is loaded as a stylesheet, another transform hook is called and the file is properly transformed. I verified this in the Vite setup and have added an integration test ensuring these two features work as expected.

I've also greatly reduced the complexity of the Vite playground to make it easier to set up examples like this in the future.

philipp-spiess avatar Oct 18 '24 12:10 philipp-spiess

  • #14716 Graphite 👈
  • next

This stack of pull requests is managed by Graphite. Learn more about stacking.

Join @philipp-spiess and the rest of your teammates on Graphite Graphite

philipp-spiess avatar Oct 18 '24 12:10 philipp-spiess

Merge activity

  • Oct 22, 12:02 PM EDT: The merge label 'merge-queue' was detected. This PR will be added to the Graphite merge queue once it meets the requirements.
  • Oct 22, 12:02 PM EDT: A user added this pull request to the Graphite merge queue.
  • Oct 22, 12:08 PM EDT: A user merged this pull request with the Graphite merge queue.

philipp-spiess avatar Oct 22 '24 16:10 philipp-spiess