refactor(styles): replace internal styles plugin with @vuetify/unplugin-styles#359
Open
AndreyYolkin wants to merge 22 commits intomainfrom
Open
refactor(styles): replace internal styles plugin with @vuetify/unplugin-styles#359AndreyYolkin wants to merge 22 commits intomainfrom
AndreyYolkin wants to merge 22 commits intomainfrom
Conversation
This centralizes all pnpm workspace configuration in a single file for better maintainability.
Member
Tried a few times, any pr ignored, check my pr there. Maybe with the vite environment api... but will required support there and nuxt v5 (may or may not work with nuxt v4 with or without env. Api experimental flag, I havent checked it yet) |
Member
|
Where is |
…nts, layers Adds a 16-test Playwright-driven SSR matrix across styles-mode (none, configFile) x run-type (dev, build) for the @vuetify/unplugin-styles integration. Uses createTest + manual vitest hook wiring so four @nuxt/test-utils setups coexist in one file without clobbering each other's module-level TestContext. Also fixes the styles-ssr fixture's settings.scss: the single-quoted "Comic Sans MS, sans-serif" collapsed into one invalid font name, making the custom-font assertion unverifiable; a proper sass list restores the cascade.
Picks up the dev-mode virtual-id fix (leading-slash + query-string normalisation) that the e2e suite was capturing via it.fails markers. Those markers were already dropped in the prior commit; this bump makes the passing run reproducible against the published package.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
vuetifyStylesPluginwith@vuetify/unplugin-styles/vite, registered fromconfigure-vite.tswith options mapped frommoduleOptions.styles.src/vite/vuetify-styles-plugin.ts,src/utils/styles-compiler.ts, and the experimental SASS pre-compile cache (includingstylesCachePathon the context and the cache helpers inutils/styles.ts).moduleOptions.stylesAPI unchanged ('sass'/'none'/{ configFile }). Nuxt-layerconfigFileresolution stays invuetify-nuxt-modulevia the existingresolveVuetifyConfigFilehelper.Test plan
pnpm -C packages/vuetify-nuxt-module test— 11 suites / 25 tests pass (addsunplugin-styles.test.ts, a 6-case unit matrix over theconfigureVitestyles branches).pnpm -C packages/vuetify-nuxt-module test:e2e— Playwright-driven SSR matrix on a dedicatedtest/fixtures/styles-ssr/fixture. 20 cases across{ 'none', { configFile } } × { dev, build }, covering FOUC, hydration, SSR client hints (prefers-color-scheme), custom SCSS variables, CSS layers, and 404-free asset loading.pnpm -C packages/vuetify-nuxt-module dev— playground (styles: { configFile }) renders Vuetify components with dark theme, date picker, locale switch; no SASS compile errors in console.ssr: true— covered by the fixture + Playwright spec.styles: 'none'— covered by thenone/*matrix entries.Notes
SSR-specific id prefix — partially valid concern
The previous
vuetifyStylesPlugindefined two virtual prefixes:vuetify-styles/(client) and/@vuetify-styles/(SSR). The single-prefix approach in@vuetify/unplugin-stylesis correct for prod builds — Vite's per-environment module graphs remove the need for a second prefix. However, the e2e suite caught a real regression in Vite dev mode:/_nuxt/vuetify-styles/lib/components/V*/V*.css(and/_nuxt/vuetify-styles-empty.cssforstyles: 'none').transformMiddlewarestrips the/_nuxt/base before plugin resolution, leaving an id like/vuetify-styles/lib/...(with leading/).@vuetify/unplugin-styles'resolveId.filter.idandload.filter.idboth anchor to bare^vuetify-styles— the leading/causes the filter to miss, Vite falls through to the static-file resolver, and the browser gets a 404.Scope of failures in dev mode: 1 URL for
styles: 'none', 11 URLs forstyles: { configFile }.Captured in tests:
styles-ssr.spec.tsscenario 6 (no 404 responses during page load) runs in all four matrix combos. The two*/devcombos are markedit.failsso CI stays green while preserving the regression signal — when the upstream fix lands, those cases flip and vitest reports "expected to fail but passed", prompting removal of the marker.Fix location (upstream,
@vuetify/unplugin-styles): strip a leading/in both theresolveIdandloadfilters (or their handlers) to accept ids that arrive via the Vite dev server's base-stripped path. Minimal change, does not require reintroducing a separate SSR prefix.Other notes
moduleOptions.styles.experimental.cacheis now silently ignored; should be noted in the release changelog.