Skip to content

support NODE_PATH in standalone build#19617

Merged
RobinMalfait merged 3 commits intotailwindlabs:mainfrom
SteffenDE:sd-node-path
Apr 17, 2026
Merged

support NODE_PATH in standalone build#19617
RobinMalfait merged 3 commits intotailwindlabs:mainfrom
SteffenDE:sd-node-path

Conversation

@SteffenDE
Copy link
Copy Markdown
Contributor

@SteffenDE SteffenDE commented Jan 29, 2026

References #19391.
References #16274.

Right now, when using the standalone build of the TailwindCSS CLI, you cannot use a custom NODE_PATH, but you can when using it via Node.js directly.

A custom NODE_PATH allows you to resolve imports from multiple locations. For example, in Phoenix LiveView, we have a feature where you can write scripts in templates that we extract at compile time to a custom folder and users can import those in their application bundle by saying

import { hooks as colocatedHooks } from "phoenix-colocated/my_app"

where the "phoenix-colocated" folder lives in a different location than the usual node_modules folder. This works fine with the default esbuild setup, as it respects NODE_PATH, so we can pass it a custom location.

We want to also support colocating CSS in templates soon, but the same approach doesn't work with the standalone Tailwind CLI we ship with default Phoenix projects. It works when running Tailwind through Node.js, but we don't want to tell users they need to install it, just to use the feature.

This patch changes the lookup logic for the standalone CLI to also account for NODE_PATH. Note that you can pass multiple paths, that are split according the the OS PATH separator.

also allows to pass a path with separator

References tailwindlabs#19391.
References tailwindlabs#16274.
@SteffenDE SteffenDE requested a review from a team as a code owner January 29, 2026 18:06
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Jan 29, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 07b2d6b4-156e-4ec1-86c6-fff463060099

📥 Commits

Reviewing files that changed from the base of the PR and between c2a894e and bca8e90.

📒 Files selected for processing (1)
  • CHANGELOG.md
✅ Files skipped from review due to trivial changes (1)
  • CHANGELOG.md

Walkthrough

The Node compile module now expands the NODE_PATH environment variable into multiple paths by splitting it on the system path delimiter for module resolution. The standalone build script no longer injects an explicit NODE_PATH value into the Bun.build definitions. A changelog entry was added noting support for NODE_PATH in the standalone build.

🚥 Pre-merge checks | ✅ 2
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title directly and accurately describes the main change: adding NODE_PATH support to the standalone Tailwind CLI build.
Description check ✅ Passed The description is well-related to the changeset, providing context about why NODE_PATH support is needed and how it will be used in real-world scenarios.

✏️ 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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@SteffenDE
Copy link
Copy Markdown
Contributor Author

Any chance to get this merged? :)

@RobinMalfait
Copy link
Copy Markdown
Member

Thanks! Will be available in the next release, and once merged it will be available in the insiders version soon.

@RobinMalfait RobinMalfait merged commit 5a835e1 into tailwindlabs:main Apr 17, 2026
9 checks passed
@SteffenDE
Copy link
Copy Markdown
Contributor Author

Nice, thank you!

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.

2 participants