Skip to content

fix: add denoteStyles() Vite plugin to fix Tailwind scanning for JSR packages - #74

Merged
deer merged 2 commits into
mainfrom
init_fix_v3
Mar 31, 2026
Merged

deer merged 2 commits into
mainfrom
init_fix_v3

Conversation

@deer

@deer deer commented Mar 31, 2026

Copy link
Copy Markdown
Owner

Problem

Tailwind v4's @source directive assumes dependencies live in node_modules. JSR packages don't — Deno caches them in its own module cache. This meant @source "node_modules/@denote/core/" silently pointed nowhere, so all framework Tailwind classes were dropped from user builds.

A second problem: @import "@denote/core/styles.css" in user CSS couldn't be resolved because @tailwindcss/vite processes CSS @import statements with its own internal resolver that bypasses Vite's resolveId plugin chain entirely.

Fix

Adds denoteStyles() to @denote/core/vite. The plugin runs with enforce: "pre" and a transform hook on CSS files, intercepting both issues before @tailwindcss/vite sees the file:

  1. Inlines @import "@denote/core/styles.css" with the actual package CSS content (loaded via import.meta.url, which points to the real location in Deno's cache)
  2. Rewrites @source "node_modules/@denote/core/" to the actual package directory derived from import.meta.url

The scaffolder (@denote/init) now generates vite.config.ts with denoteStyles() included. The docs site is updated to use the same pattern, dogfooding the plugin.

Also fixes implicit any type errors in mcp.ts resource callbacks (uri: URL, { slug }: Variables).

@deer
deer merged commit 63dea93 into main Mar 31, 2026
4 checks passed
@deer
deer deleted the init_fix_v3 branch March 31, 2026 09:08
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.

1 participant