support NODE_PATH in standalone build#19617
Conversation
also allows to pass a path with separator References tailwindlabs#19391. References tailwindlabs#16274.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
✅ Files skipped from review due to trivial changes (1)
WalkthroughThe Node compile module now expands the 🚥 Pre-merge checks | ✅ 2✅ Passed checks (2 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 |
|
Any chance to get this merged? :) |
|
Thanks! Will be available in the next release, and once merged it will be available in the |
|
Nice, thank you! |
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
where the "phoenix-colocated" folder lives in a different location than the usual
node_modulesfolder. This works fine with the default esbuild setup, as it respectsNODE_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.