Skip to content

Local plugins added using @plugin, as a directory import, with an index.ts entrypoint, fails to be picked up #1196

@sxxov

Description

@sxxov

hi! thanks all the maintainers for this crucial additional to the tailwind ecosystem, really can't imagine working without it!

problem

not sure if this is the correct repo to report this, but i've noticed that intellisense on vscode would skip classes that were added through local plugins if the following conditions were met:

  1. i import them via @plugin,
  2. the path is a directory, &
  3. the file entrypoint is index.ts instead of index.js

on the flipside, tailwind itself would compile them fine & the classes missed by editor tools would show up on the frontend.

repro

include a plugin by its directory, containing only an index.ts file:

/* globals.css */
@plugin '../grid-auto-fit';
// grid-auto-fit/index.ts
/* eslint-disable @typescript-eslint/unbound-method */
import plugin from 'tailwindcss/plugin';

const tailwindPluginGridAutoFit = plugin(
	({ matchUtilities, theme }) => {
		matchUtilities(
			{
				'grid-cols-auto-fit': (v) => ({
					gridTemplateColumns: `repeat(auto-fit, minmax(min(100%, ${String(v)}), 1fr))`,
				}),
				'grid-rows-auto-fit': (v) => ({
					gridTemplateRows: `repeat(auto-fit, minmax(min(100%, ${String(v)}), 1fr))`,
				}),
			},
			{
				values: theme('gridAutoFit')!,
			},
		);
	},
	{
		theme: {
			gridAutoFit: ({ theme }) => theme('maxWidth'),
		},
	},
);

export default tailwindPluginGridAutoFit;

workaround

qualify the path with index.ts,

/* plugin is: grid-auto-fit/index.ts */
@plugin '../grid-auto-fit/index.ts';

or use js to write the plugin

/* plugin is: grid-auto-fit/index.js */
@plugin '../grid-auto-fit';

environment

i'm working in a nextjs app on react 19:

"tailwindcss": "^4.0.6",
"@tailwindcss/postcss": "^4.0.6",
"next": "^15.1.7",
"react": "^19.0.0",

thanks in advanced for the help!

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions