fix(vite): avoid resolving JS plugins to browser CSS entries#19949
Conversation
WalkthroughAdded Vite resolver integration tests that verify Tailwind 🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (2)
packages/@tailwindcss-vite/src/index.ts (1)
85-92: Optional: consider logging/debug when a JS plugin resolves to a non-JS file.When
customJsResolverreceives an absolute, non-self-resolved path that failsisPotentialJsRootFile(e.g. thebrowser-field CSS case this PR targets), silently returningundefinedlets Tailwind's internal fallback recover — which is exactly the desired behavior. However, if a future misconfiguration causes a plugin to resolve to, say, a.wasmor extensionless path, the silent rejection would be hard to diagnose. ADEBUG &&log here would aid future debugging without affecting behavior.Not blocking.
Also applies to: 142-149
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/`@tailwindcss-vite/src/index.ts around lines 85 - 92, In customJsResolver, add a conditional debug log when jsResolver returns an absolute path that is not the original id but fails isPotentialJsRootFile so the function still returns undefined; specifically, after the check if (!isPotentialJsRootFile(resolved)) return, log a DEBUG-level message (guarded by a DEBUG flag or logger.isDebugEnabled) that includes the id, base, and resolved values to aid debugging of mis-resolved plugins (referencing customJsResolver, jsResolver, and isPotentialJsRootFile).integrations/vite/resolvers.test.ts (1)
353-390: LGTM — build + dev coverage matches the rest of the suite.Both tests assert the JS-entry-generated utility (
browser-css-plugin) is present in the emitted CSS, which directly verifies the fix path. One nit: you could additionally assert that the CSS from thebrowserfield (e.g..should-not-be-loaded-as-a-plugin) is NOT present, to catch a future regression where the CSS file is erroneously inlined as a plugin. Optional.🧪 Optional: add negative assertion
await fs.expectFileToContain(filename, [candidate`browser-css-plugin`]) + await fs.expectFileNotToContain(filename, ['should-not-be-loaded-as-a-plugin'])(adjust to whatever negative-match helper the test utils expose)
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@integrations/vite/resolvers.test.ts` around lines 353 - 390, Add a negative assertion to both tests to ensure the CSS referenced by the package "browser" field (e.g. the selector ".should-not-be-loaded-as-a-plugin") is NOT present in the resolved styles; locate the tests titled 'resolves package plugins to JS entries in production build when browser points to CSS' and 'resolves package plugins to JS entries in dev mode when browser points to CSS' (using browserCssPluginFixture), and after verifying the positive presence of candidate`browser-css-plugin` use the same style-fetch/assert helpers (fs.expectFileToContain for build and fetchStyles/retryAssertion for dev) to assert the unwanted selector string is absent.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@integrations/vite/resolvers.test.ts`:
- Around line 353-390: Add a negative assertion to both tests to ensure the CSS
referenced by the package "browser" field (e.g. the selector
".should-not-be-loaded-as-a-plugin") is NOT present in the resolved styles;
locate the tests titled 'resolves package plugins to JS entries in production
build when browser points to CSS' and 'resolves package plugins to JS entries in
dev mode when browser points to CSS' (using browserCssPluginFixture), and after
verifying the positive presence of candidate`browser-css-plugin` use the same
style-fetch/assert helpers (fs.expectFileToContain for build and
fetchStyles/retryAssertion for dev) to assert the unwanted selector string is
absent.
In `@packages/`@tailwindcss-vite/src/index.ts:
- Around line 85-92: In customJsResolver, add a conditional debug log when
jsResolver returns an absolute path that is not the original id but fails
isPotentialJsRootFile so the function still returns undefined; specifically,
after the check if (!isPotentialJsRootFile(resolved)) return, log a DEBUG-level
message (guarded by a DEBUG flag or logger.isDebugEnabled) that includes the id,
base, and resolved values to aid debugging of mis-resolved plugins (referencing
customJsResolver, jsResolver, and isPotentialJsRootFile).
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 75ca52d8-70e6-48ce-874f-72ac2ba45ddb
📒 Files selected for processing (2)
integrations/vite/resolvers.test.tspackages/@tailwindcss-vite/src/index.ts
There was a problem hiding this comment.
🧹 Nitpick comments (1)
integrations/vite/resolvers.test.ts (1)
292-453: Optional: dedupe the two new tests' fixture.The build and dev variants share an identical ~60-line
fsfixture. Consider extracting the fixture to a sharedconst(or usingdescribe.each([...])with the build/dev runner bodies) to reduce the chance of the two tests drifting out of sync in future edits. Not blocking.♻️ Sketch
const browserCssPluginFs = { 'package.json': json`…`, 'pnpm-workspace.yaml': yaml`…`, 'packages/plugin-browser-css/package.json': json`…`, 'packages/plugin-browser-css/index.js': js`…`, 'packages/plugin-browser-css/browser.css': css`…`, 'vite.config.ts': ts`…`, 'index.html': html`…`, 'src/index.css': css` `@import` 'tailwindcss'; `@plugin` 'plugin-browser-css'; `, } test('…production build…', { fs: browserCssPluginFs }, async ({ fs, exec, expect }) => { /* … */ }) test('…dev mode…', { fs: browserCssPluginFs }, async ({ spawn, expect }) => { /* … */ })🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@integrations/vite/resolvers.test.ts` around lines 292 - 453, Extract the repeated fs fixture into a shared constant (e.g. browserCssPluginFs) and reuse it in both tests instead of duplicating the ~60-line object; locate the two tests titled "resolves package plugins to JS entries in production build when browser points to CSS" and "resolves package plugins to JS entries in dev mode when browser points to CSS" and replace their inline fs: { ... } blocks with fs: browserCssPluginFs (or pass the const directly as the second argument), keeping existing test bodies (exec/spawn/expect) unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@integrations/vite/resolvers.test.ts`:
- Around line 292-453: Extract the repeated fs fixture into a shared constant
(e.g. browserCssPluginFs) and reuse it in both tests instead of duplicating the
~60-line object; locate the two tests titled "resolves package plugins to JS
entries in production build when browser points to CSS" and "resolves package
plugins to JS entries in dev mode when browser points to CSS" and replace their
inline fs: { ... } blocks with fs: browserCssPluginFs (or pass the const
directly as the second argument), keeping existing test bodies
(exec/spawn/expect) unchanged.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: ebdf78eb-aeb8-478a-9735-a803c5604a2b
📒 Files selected for processing (2)
integrations/vite/resolvers.test.tspackages/@tailwindcss-vite/src/index.ts
RobinMalfait
left a comment
There was a problem hiding this comment.
Thanks! Made some changes by removing the explicit extension list, and by trying to resolve the aliases first. Then fallback to the default resolving logic we used to have. If we resolve to a .css file in the JS resolvers we bail as well.
|
Would be great to have it released - it's a small blocker for my library |
* fix: pin tailwindcss to 4.2.2 via pnpm overrides to work around css extension error * Fix: tailwindlabs/tailwindcss#19949
|
same here, been waiting for this fix to be released. I hope 4.2.5 lands soon. |
Here is everything you need to know about this update. Please take a good look at what changed and the test results before merging this pull request. ### What changed? #### ✳️ eslint (9.30.1 → 9.32.0) · [Repo](https://github.com/eslint/eslint) · [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md) <details> <summary>Release Notes</summary> <h4><a href="https://github.com/eslint/eslint/releases/tag/v9.32.0">9.32.0</a></h4> <blockquote><h2 dir="auto">Features</h2> <ul dir="auto"> <li> <a href="https://bounce.depfu.com/github.com/eslint/eslint/commit/1245000c5a81954d42f0c7eb670efe450c3bbad5"><code class="notranslate">1245000</code></a> feat: support explicit resource management in core rules (<a href="https://bounce.depfu.com/github.com/eslint/eslint/pull/19828">#19828</a>) (fnx)</li> <li> <a href="https://bounce.depfu.com/github.com/eslint/eslint/commit/0e957a7b5528f375a51e7c1a2fd1b03cdcd2af2d"><code class="notranslate">0e957a7</code></a> feat: support typescript types in accessor rules (<a href="https://bounce.depfu.com/github.com/eslint/eslint/pull/19882">#19882</a>) (fnx)</li> </ul> <h2 dir="auto">Bug Fixes</h2> <ul dir="auto"> <li> <a href="https://bounce.depfu.com/github.com/eslint/eslint/commit/960fd40dfd204af30726b49b6bec714fe49a606e"><code class="notranslate">960fd40</code></a> fix: Upgrade @eslint/js (<a href="https://bounce.depfu.com/github.com/eslint/eslint/pull/19971">#19971</a>) (Nicholas C. Zakas)</li> <li> <a href="https://bounce.depfu.com/github.com/eslint/eslint/commit/bbf23fa2f1c6058f6cb5c9f2f32460a15e75e596"><code class="notranslate">bbf23fa</code></a> fix: Refactor reporting into FileReport (<a href="https://bounce.depfu.com/github.com/eslint/eslint/pull/19877">#19877</a>) (Nicholas C. Zakas)</li> <li> <a href="https://bounce.depfu.com/github.com/eslint/eslint/commit/d4988872f375890bf677ce1a1d92a505085b51fa"><code class="notranslate">d498887</code></a> fix: bump @eslint/plugin-kit to 0.3.4 to resolve vulnerability (<a href="https://bounce.depfu.com/github.com/eslint/eslint/pull/19965">#19965</a>) (Milos Djermanovic)</li> <li> <a href="https://bounce.depfu.com/github.com/eslint/eslint/commit/f46fc6c137c951bc73cf3bd9446053c1b11f769b"><code class="notranslate">f46fc6c</code></a> fix: report only global references in no-implied-eval (<a href="https://bounce.depfu.com/github.com/eslint/eslint/pull/19932">#19932</a>) (Nitin Kumar)</li> <li> <a href="https://bounce.depfu.com/github.com/eslint/eslint/commit/7863d26b7cfb03a81ec86f93439757ff60bf6afb"><code class="notranslate">7863d26</code></a> fix: remove outdated types in <code class="notranslate">ParserOptions.ecmaFeatures</code> (<a href="https://bounce.depfu.com/github.com/eslint/eslint/pull/19944">#19944</a>) (ntnyq)</li> <li> <a href="https://bounce.depfu.com/github.com/eslint/eslint/commit/317330552e2d276221c7f2dd9c1516ad8b41cc3c"><code class="notranslate">3173305</code></a> fix: update execScript message in no-implied-eval rule (<a href="https://bounce.depfu.com/github.com/eslint/eslint/pull/19937">#19937</a>) (TKDev7)</li> </ul> <h2 dir="auto">Documentation</h2> <ul dir="auto"> <li> <a href="https://bounce.depfu.com/github.com/eslint/eslint/commit/86e7426e4463ca49ffa5c82e825ecb6aa19ca8a0"><code class="notranslate">86e7426</code></a> docs: Update README (GitHub Actions Bot)</li> </ul> <h2 dir="auto">Chores</h2> <ul dir="auto"> <li> <a href="https://bounce.depfu.com/github.com/eslint/eslint/commit/50de1ced9df2b1ee48ee6843c8cfe0f5d8edbc27"><code class="notranslate">50de1ce</code></a> chore: package.json update for @eslint/js release (Jenkins)</li> <li> <a href="https://bounce.depfu.com/github.com/eslint/eslint/commit/74f01a3f5905aaa0902837ced2425209c09c048f"><code class="notranslate">74f01a3</code></a> ci: unpin <code class="notranslate">jiti</code> to version <code class="notranslate">^2.5.1</code> (<a href="https://bounce.depfu.com/github.com/eslint/eslint/pull/19970">#19970</a>) (루밀LuMir)</li> <li> <a href="https://bounce.depfu.com/github.com/eslint/eslint/commit/2ab13813a7e7f3014c35490b351447ec43229951"><code class="notranslate">2ab1381</code></a> ci: pin <code class="notranslate">jiti</code> to version 2.4.2 (<a href="https://bounce.depfu.com/github.com/eslint/eslint/pull/19964">#19964</a>) (Francesco Trotta)</li> <li> <a href="https://bounce.depfu.com/github.com/eslint/eslint/commit/b7f75454695079f54b77fcdc9ebe3b9199d5ad30"><code class="notranslate">b7f7545</code></a> test: switch to flat config mode in <code class="notranslate">SourceCode</code> tests (<a href="https://bounce.depfu.com/github.com/eslint/eslint/pull/19953">#19953</a>) (Milos Djermanovic)</li> <li> <a href="https://bounce.depfu.com/github.com/eslint/eslint/commit/f5a35e3b7cee17cd31fc02c24c3e74b42ee202bc"><code class="notranslate">f5a35e3</code></a> test: switch to flat config mode in eslint-fuzzer (<a href="https://bounce.depfu.com/github.com/eslint/eslint/pull/19960">#19960</a>) (Milos Djermanovic)</li> <li> <a href="https://bounce.depfu.com/github.com/eslint/eslint/commit/e22af8c42d622d8d912ee7bedf49bf4283247fdc"><code class="notranslate">e22af8c</code></a> refactor: use <code class="notranslate">CustomRuleDefinitionType</code> in <code class="notranslate">JSRuleDefinition</code> (<a href="https://bounce.depfu.com/github.com/eslint/eslint/pull/19949">#19949</a>) (Francesco Trotta)</li> <li> <a href="https://bounce.depfu.com/github.com/eslint/eslint/commit/e85571730f1360464b7ee00695c678d551f9c643"><code class="notranslate">e855717</code></a> chore: switch performance tests to hyperfine (<a href="https://bounce.depfu.com/github.com/eslint/eslint/pull/19919">#19919</a>) (Francesco Trotta)</li> <li> <a href="https://bounce.depfu.com/github.com/eslint/eslint/commit/2f73a23655092a41780859ffe0a07c44a2f1b5f5"><code class="notranslate">2f73a23</code></a> test: switch to flat config mode in <code class="notranslate">ast-utils</code> tests (<a href="https://bounce.depfu.com/github.com/eslint/eslint/pull/19948">#19948</a>) (Milos Djermanovic)</li> <li> <a href="https://bounce.depfu.com/github.com/eslint/eslint/commit/c565a530f50c96dacd44e096f7d531b073aa4dc7"><code class="notranslate">c565a53</code></a> chore: exclude <code class="notranslate">further_reading_links.json</code> from Prettier formatting (<a href="https://bounce.depfu.com/github.com/eslint/eslint/pull/19943">#19943</a>) (Milos Djermanovic)</li> </ul></blockquote> <h4><a href="https://github.com/eslint/eslint/releases/tag/v9.31.0">9.31.0</a></h4> <blockquote><h2 dir="auto">Features</h2> <ul dir="auto"> <li> <a href="https://bounce.depfu.com/github.com/eslint/eslint/commit/35cf44c22e36b1554486e7a75c870e86c10b83f8"><code class="notranslate">35cf44c</code></a> feat: output full actual location in rule tester if different (<a href="https://bounce.depfu.com/github.com/eslint/eslint/pull/19904">#19904</a>) (ST-DDT)</li> <li> <a href="https://bounce.depfu.com/github.com/eslint/eslint/commit/a6a63259de6cb5642f69c7be429554bbcedca4c0"><code class="notranslate">a6a6325</code></a> feat: support explicit resource management in <code class="notranslate">no-loop-func</code> (<a href="https://bounce.depfu.com/github.com/eslint/eslint/pull/19895">#19895</a>) (Milos Djermanovic)</li> <li> <a href="https://bounce.depfu.com/github.com/eslint/eslint/commit/4682cdc6960279ee17f23899fbab6f58d881eadf"><code class="notranslate">4682cdc</code></a> feat: support explicit resource management in <code class="notranslate">no-undef-init</code> (<a href="https://bounce.depfu.com/github.com/eslint/eslint/pull/19894">#19894</a>) (Milos Djermanovic)</li> <li> <a href="https://bounce.depfu.com/github.com/eslint/eslint/commit/58482165eaf597cc5c58216a956c301ae87520b3"><code class="notranslate">5848216</code></a> feat: support explicit resource management in <code class="notranslate">init-declarations</code> (<a href="https://bounce.depfu.com/github.com/eslint/eslint/pull/19893">#19893</a>) (Milos Djermanovic)</li> <li> <a href="https://bounce.depfu.com/github.com/eslint/eslint/commit/bb370b8e79f65ee32d9d89ecf249fb74a141ad22"><code class="notranslate">bb370b8</code></a> feat: support explicit resource management in <code class="notranslate">no-const-assign</code> (<a href="https://bounce.depfu.com/github.com/eslint/eslint/pull/19892">#19892</a>) (Milos Djermanovic)</li> </ul> <h2 dir="auto">Bug Fixes</h2> <ul dir="auto"> <li> <a href="https://bounce.depfu.com/github.com/eslint/eslint/commit/07fac6cafa0426b4d1ea12d9001f3955f19b286d"><code class="notranslate">07fac6c</code></a> fix: retry on EMFILE when writing autofix results (<a href="https://bounce.depfu.com/github.com/eslint/eslint/pull/19926">#19926</a>) (TKDev7)</li> <li> <a href="https://bounce.depfu.com/github.com/eslint/eslint/commit/28cc7abbb72b29b1cac6fc4253646a7839586064"><code class="notranslate">28cc7ab</code></a> fix: Remove incorrect RuleContext types (<a href="https://bounce.depfu.com/github.com/eslint/eslint/pull/19910">#19910</a>) (Nicholas C. Zakas)</li> </ul> <h2 dir="auto">Documentation</h2> <ul dir="auto"> <li> <a href="https://bounce.depfu.com/github.com/eslint/eslint/commit/664cb44ab03785bd200a792607a7e20faa2d4b28"><code class="notranslate">664cb44</code></a> docs: Update README (GitHub Actions Bot)</li> <li> <a href="https://bounce.depfu.com/github.com/eslint/eslint/commit/40dbe2a43f83d366e9026faec70293512fb61ca2"><code class="notranslate">40dbe2a</code></a> docs: fix mismatch between <code class="notranslate">globalIgnores()</code> code and text (<a href="https://bounce.depfu.com/github.com/eslint/eslint/pull/19914">#19914</a>) (MaoShizhong)</li> <li> <a href="https://bounce.depfu.com/github.com/eslint/eslint/commit/5a0069d60815246cf24e1c96125540792c2507ef"><code class="notranslate">5a0069d</code></a> docs: Update README (GitHub Actions Bot)</li> <li> <a href="https://bounce.depfu.com/github.com/eslint/eslint/commit/fef04b5c7fea99362d67b31b8e98cd4914020ed3"><code class="notranslate">fef04b5</code></a> docs: Update working on issues info (<a href="https://bounce.depfu.com/github.com/eslint/eslint/pull/19902">#19902</a>) (Nicholas C. Zakas)</li> </ul> <h2 dir="auto">Chores</h2> <ul dir="auto"> <li> <a href="https://bounce.depfu.com/github.com/eslint/eslint/commit/3ddd454c1c73294e5af7905d60d03fac162f1b3e"><code class="notranslate">3ddd454</code></a> chore: upgrade to <code class="notranslate">@eslint/js@9.31.0</code> (<a href="https://bounce.depfu.com/github.com/eslint/eslint/pull/19935">#19935</a>) (Francesco Trotta)</li> <li> <a href="https://bounce.depfu.com/github.com/eslint/eslint/commit/d5054e5454a537e9ade238c768c262c6c592cbc1"><code class="notranslate">d5054e5</code></a> chore: package.json update for @eslint/js release (Jenkins)</li> <li> <a href="https://bounce.depfu.com/github.com/eslint/eslint/commit/0f4a3781fe7c11fad7b206c3c694655486ddd187"><code class="notranslate">0f4a378</code></a> chore: update eslint (<a href="https://bounce.depfu.com/github.com/eslint/eslint/pull/19933">#19933</a>) (renovate[bot])</li> <li> <a href="https://bounce.depfu.com/github.com/eslint/eslint/commit/76c2340c368f96db77439b5cd1df0196cc39bf3e"><code class="notranslate">76c2340</code></a> chore: bump mocha to v11 (<a href="https://bounce.depfu.com/github.com/eslint/eslint/pull/19917">#19917</a>) (루밀LuMir)</li> </ul></blockquote> <p><em>Does any of this look wrong? <a href="https://depfu.com/packages/npm/eslint/feedback">Please let us know.</a></em></p> </details> <details> <summary>Commits</summary> <p><a href="https://github.com/eslint/eslint/compare/6769b5fa11ecfb2c2cf78472d3d90564a1e01d3c...2364031090daafe34e80904c32065bfe4692d7a2">See the full diff on Github</a>. The new version differs by 37 commits:</p> <ul> <li><a href="https://github.com/eslint/eslint/commit/2364031090daafe34e80904c32065bfe4692d7a2"><code>9.32.0</code></a></li> <li><a href="https://github.com/eslint/eslint/commit/a0e62e2739a5e214b1d371eda76f6a3b664e222a"><code>Build: changelog update for 9.32.0</code></a></li> <li><a href="https://github.com/eslint/eslint/commit/960fd40dfd204af30726b49b6bec714fe49a606e"><code>fix: Upgrade @eslint/js (tailwindlabs#19971)</code></a></li> <li><a href="https://github.com/eslint/eslint/commit/50de1ced9df2b1ee48ee6843c8cfe0f5d8edbc27"><code>chore: package.json update for @eslint/js release</code></a></li> <li><a href="https://github.com/eslint/eslint/commit/bbf23fa2f1c6058f6cb5c9f2f32460a15e75e596"><code>fix: Refactor reporting into FileReport (tailwindlabs#19877)</code></a></li> <li><a href="https://github.com/eslint/eslint/commit/74f01a3f5905aaa0902837ced2425209c09c048f"><code>ci: unpin `jiti` to version `^2.5.1` (tailwindlabs#19970)</code></a></li> <li><a href="https://github.com/eslint/eslint/commit/d4988872f375890bf677ce1a1d92a505085b51fa"><code>fix: bump @eslint/plugin-kit to 0.3.4 to resolve vulnerability (tailwindlabs#19965)</code></a></li> <li><a href="https://github.com/eslint/eslint/commit/2ab13813a7e7f3014c35490b351447ec43229951"><code>ci: pin `jiti` to version 2.4.2 (tailwindlabs#19964)</code></a></li> <li><a href="https://github.com/eslint/eslint/commit/b7f75454695079f54b77fcdc9ebe3b9199d5ad30"><code>test: switch to flat config mode in `SourceCode` tests (tailwindlabs#19953)</code></a></li> <li><a href="https://github.com/eslint/eslint/commit/f5a35e3b7cee17cd31fc02c24c3e74b42ee202bc"><code>test: switch to flat config mode in eslint-fuzzer (tailwindlabs#19960)</code></a></li> <li><a href="https://github.com/eslint/eslint/commit/f46fc6c137c951bc73cf3bd9446053c1b11f769b"><code>fix: report only global references in no-implied-eval (tailwindlabs#19932)</code></a></li> <li><a href="https://github.com/eslint/eslint/commit/86e7426e4463ca49ffa5c82e825ecb6aa19ca8a0"><code>docs: Update README</code></a></li> <li><a href="https://github.com/eslint/eslint/commit/e22af8c42d622d8d912ee7bedf49bf4283247fdc"><code>refactor: use `CustomRuleDefinitionType` in `JSRuleDefinition` (tailwindlabs#19949)</code></a></li> <li><a href="https://github.com/eslint/eslint/commit/1245000c5a81954d42f0c7eb670efe450c3bbad5"><code>feat: support explicit resource management in core rules (tailwindlabs#19828)</code></a></li> <li><a href="https://github.com/eslint/eslint/commit/e85571730f1360464b7ee00695c678d551f9c643"><code>chore: switch performance tests to hyperfine (tailwindlabs#19919)</code></a></li> <li><a href="https://github.com/eslint/eslint/commit/0e957a7b5528f375a51e7c1a2fd1b03cdcd2af2d"><code>feat: support typescript types in accessor rules (tailwindlabs#19882)</code></a></li> <li><a href="https://github.com/eslint/eslint/commit/2f73a23655092a41780859ffe0a07c44a2f1b5f5"><code>test: switch to flat config mode in `ast-utils` tests (tailwindlabs#19948)</code></a></li> <li><a href="https://github.com/eslint/eslint/commit/7863d26b7cfb03a81ec86f93439757ff60bf6afb"><code>fix: remove outdated types in `ParserOptions.ecmaFeatures` (tailwindlabs#19944)</code></a></li> <li><a href="https://github.com/eslint/eslint/commit/c565a530f50c96dacd44e096f7d531b073aa4dc7"><code>chore: exclude `further_reading_links.json` from Prettier formatting (tailwindlabs#19943)</code></a></li> <li><a href="https://github.com/eslint/eslint/commit/317330552e2d276221c7f2dd9c1516ad8b41cc3c"><code>fix: update execScript message in no-implied-eval rule (tailwindlabs#19937)</code></a></li> <li><a href="https://github.com/eslint/eslint/commit/14053edc64bd378ab920575f2488fbfcbb5a4ea0"><code>9.31.0</code></a></li> <li><a href="https://github.com/eslint/eslint/commit/2b77bd05dc50911bc97b2d2711dd75f6b5d9b9fd"><code>Build: changelog update for 9.31.0</code></a></li> <li><a href="https://github.com/eslint/eslint/commit/3ddd454c1c73294e5af7905d60d03fac162f1b3e"><code>chore: upgrade to `@eslint/js@9.31.0` (tailwindlabs#19935)</code></a></li> <li><a href="https://github.com/eslint/eslint/commit/d5054e5454a537e9ade238c768c262c6c592cbc1"><code>chore: package.json update for @eslint/js release</code></a></li> <li><a href="https://github.com/eslint/eslint/commit/0f4a3781fe7c11fad7b206c3c694655486ddd187"><code>chore: update eslint (tailwindlabs#19933)</code></a></li> <li><a href="https://github.com/eslint/eslint/commit/664cb44ab03785bd200a792607a7e20faa2d4b28"><code>docs: Update README</code></a></li> <li><a href="https://github.com/eslint/eslint/commit/07fac6cafa0426b4d1ea12d9001f3955f19b286d"><code>fix: retry on EMFILE when writing autofix results (tailwindlabs#19926)</code></a></li> <li><a href="https://github.com/eslint/eslint/commit/35cf44c22e36b1554486e7a75c870e86c10b83f8"><code>feat: output full actual location in rule tester if different (tailwindlabs#19904)</code></a></li> <li><a href="https://github.com/eslint/eslint/commit/40dbe2a43f83d366e9026faec70293512fb61ca2"><code>docs: fix mismatch between `globalIgnores()` code and text (tailwindlabs#19914)</code></a></li> <li><a href="https://github.com/eslint/eslint/commit/76c2340c368f96db77439b5cd1df0196cc39bf3e"><code>chore: bump mocha to v11 (tailwindlabs#19917)</code></a></li> <li><a href="https://github.com/eslint/eslint/commit/28cc7abbb72b29b1cac6fc4253646a7839586064"><code>fix: Remove incorrect RuleContext types (tailwindlabs#19910)</code></a></li> <li><a href="https://github.com/eslint/eslint/commit/a6a63259de6cb5642f69c7be429554bbcedca4c0"><code>feat: support explicit resource management in `no-loop-func` (tailwindlabs#19895)</code></a></li> <li><a href="https://github.com/eslint/eslint/commit/4682cdc6960279ee17f23899fbab6f58d881eadf"><code>feat: support explicit resource management in `no-undef-init` (tailwindlabs#19894)</code></a></li> <li><a href="https://github.com/eslint/eslint/commit/58482165eaf597cc5c58216a956c301ae87520b3"><code>feat: support explicit resource management in `init-declarations` (tailwindlabs#19893)</code></a></li> <li><a href="https://github.com/eslint/eslint/commit/bb370b8e79f65ee32d9d89ecf249fb74a141ad22"><code>feat: support explicit resource management in `no-const-assign` (tailwindlabs#19892)</code></a></li> <li><a href="https://github.com/eslint/eslint/commit/5a0069d60815246cf24e1c96125540792c2507ef"><code>docs: Update README</code></a></li> <li><a href="https://github.com/eslint/eslint/commit/fef04b5c7fea99362d67b31b8e98cd4914020ed3"><code>docs: Update working on issues info (tailwindlabs#19902)</code></a></li> </ul> </details> ---  [Depfu](https://depfu.com) will automatically keep this PR conflict-free, as long as you don't add any commits to this branch yourself. You can also trigger a rebase manually by commenting with `@depfu rebase`. <details><summary>All Depfu comment commands</summary> <blockquote><dl> <dt>@depfu rebase</dt><dd>Rebases against your default branch and redoes this update</dd> <dt>@depfu recreate</dt><dd>Recreates this PR, overwriting any edits that you've made to it</dd> <dt>@depfu merge</dt><dd>Merges this PR once your tests are passing and conflicts are resolved</dd> <dt>@depfu cancel merge</dt><dd>Cancels automatic merging of this PR</dd> <dt>@depfu close</dt><dd>Closes this PR and deletes the branch</dd> <dt>@depfu reopen</dt><dd>Restores the branch and reopens this PR (if it's closed)</dd> <dt>@depfu pause</dt><dd>Ignores all future updates for this dependency and closes this PR</dd> <dt>@depfu pause [minor|major]</dt><dd>Ignores all future minor/major updates for this dependency and closes this PR</dd> <dt>@depfu resume</dt><dd>Future versions of this dependency will create PRs again (leaves this PR as is)</dd> </dl></blockquote> </details> Co-authored-by: depfu[bot] <23717796+depfu[bot]@users.noreply.github.com>



Edit: some edits by @RobinMalfait
Summary
Fix a regression in
@tailwindcss/viteintroduced by#19803where JS plugin resolution could incorrectly resolve a package to itsbrowserCSS entry.In cases like
daisyui, Vite can resolve@plugin "daisyui"todaisyui.cssinstead of the package's JS entry, which causes Tailwind to try to load a CSS file as a JS plugin and fail with:This change keeps the
aliasOnly: falsebehavior from#19803so tsconfig path resolution still works, but adds a JS-entry guard tocustomJsResolverin@tailwindcss/vite. If Vite resolves a plugin request to a non-JS file like.css, the custom resolver now returnsundefinedso Tailwind's internal fallback resolver can resolve the package as a JS plugin entry instead.I also added integration coverage for a package whose
main/modulepoints to JS whilebrowserpoints to CSS, and verified that@plugin "pkg"still resolves to the JS entry in both build and dev mode.Test plan
Added new integration tests in
integrations/vite/resolvers.test.tscovering a package with:main/module-> JSbrowser-> CSS@plugin "pkg"-> should resolve to JS, not CSSVerified with:
These verify that:
@pluginno longer resolves to a CSS browser entry#19803still works in both build and dev modeMaintainer edits:
Instead of hardcoding file extensions, first try to resolve aliases and then fallback to the default resolving system we had before. We still check for a
.cssextension, even in the JS resolver because some dependencies (likedaisyUI) put the CSS file there instead of in anexports.style. If we detect that, we still fallback to the default resolving logic.This should be compatible with the original issue we were trying to fix where we wanted to make Vite aliases work.
Fixes: #19950
[ci-all]