Skip to content

fix(vite-plugin-angular): use single ? for JIT style resolve suffix#2096

Merged
brandonroberts merged 2 commits into
analogjs:mainfrom
AlonMiz:fix/jit-style-resolve-double-question-mark
Mar 1, 2026
Merged

fix(vite-plugin-angular): use single ? for JIT style resolve suffix#2096
brandonroberts merged 2 commits into
analogjs:mainfrom
AlonMiz:fix/jit-style-resolve-double-question-mark

Conversation

@AlonMiz

@AlonMiz AlonMiz commented Mar 1, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes #2094

The resolveId hook uses ?? (double question mark) for the style/template URL suffix, producing URLs like path??inline. Vite does not recognize ??inline as an inline CSS import — it only recognizes ?inline (single ?).

This causes SCSS/LESS files to be loaded as raw text without preprocessing in production builds.

The Fix

- )}??${id.includes(':style') ? 'inline' : 'raw'}`;
+ )}?${id.includes(':style') ? 'inline' : 'raw'}`;

One character change: ???.

Verification

new URL("file:///path/to/file?inline").searchParams   // { inline: "" } ✅
new URL("file:///path/to/file??inline").searchParams   // { "?inline": "" } ❌

Context

This is a regression from bcb6da9 (PR #2024), which correctly added the style vs template differentiation but accidentally used ?? instead of ?.

The resolveId hook uses `??` (double question mark) for the style/template
suffix, producing URLs like `path??inline`. This is incorrect because:

- `?inline` → URL search params: `{ inline: '' }` ✅ (Vite recognizes this)
- `??inline` → URL search params: `{ '?inline': '' }` ❌ (Vite does NOT recognize this)

With `??inline`, Vite's CSS pipeline does not process the file, so SCSS/LESS
files are loaded as raw text without preprocessing in production builds.

Fixes the regression introduced in bcb6da9 (PR analogjs#2024).
Fixes analogjs#2094
@netlify

netlify Bot commented Mar 1, 2026

Copy link
Copy Markdown

Deploy Preview for analog-docs ready!

Name Link
🔨 Latest commit c603fdf
🔍 Latest deploy log https://app.netlify.com/projects/analog-docs/deploys/69a4775bf6d63f00084feb92
😎 Deploy Preview https://deploy-preview-2096--analog-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify

netlify Bot commented Mar 1, 2026

Copy link
Copy Markdown

Deploy Preview for analog-app ready!

Name Link
🔨 Latest commit c603fdf
🔍 Latest deploy log https://app.netlify.com/projects/analog-app/deploys/69a4775bfa78ca0008b749d9
😎 Deploy Preview https://deploy-preview-2096--analog-app.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify

netlify Bot commented Mar 1, 2026

Copy link
Copy Markdown

Deploy Preview for analog-blog ready!

Name Link
🔨 Latest commit c603fdf
🔍 Latest deploy log https://app.netlify.com/projects/analog-blog/deploys/69a4775b9667860008e012d8
😎 Deploy Preview https://deploy-preview-2096--analog-blog.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Verifies that:
- Style files (angular:jit:style:file;) are resolved with ?inline (single ?)
- Template files (angular:jit:template:file;) are resolved with ?raw (single ?)
- Neither uses ?? (double question mark) which Vite does not recognize
@brandonroberts brandonroberts merged commit 7693930 into analogjs:main Mar 1, 2026
18 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.

3 participants