Repository navigation
fix: resolve tailwindcss from project context in monorepo setups - #1771
Open
elizhabiboullah wants to merge 1 commit into
Open
elizhabiboullah wants to merge 1 commit into
elizhabiboullah wants to merge 1 commit into
Conversation
In pnpm monorepos, NativeWind's own node_modules may contain a nested
copy of tailwindcss (potentially v4) which differs from the version
installed in the user's project. This causes three distinct failures:
1. Version check fails: The import of tailwindcss/package.json resolves
from NativeWind's node_modules, detecting v4 and throwing
'NativeWind only supports Tailwind CSS v3' even when the project
has v3 correctly installed.
2. loadConfig export missing: require('tailwindcss/loadConfig') resolves
to the nested v4 copy which does not export this subpath, causing
ERR_PACKAGE_PATH_NOT_EXPORTED errors.
3. Config path resolution: The default tailwind.config path is resolved
relative to cwd, which in monorepo setups (where you run from the
workspace root) points to the wrong directory.
This commit fixes all three issues:
- Uses require.resolve with paths:[process.cwd()] to resolve tailwindcss
from the user's project context first, falling back to NativeWind's own
resolution.
- Resolves configPath relative to projectRoot when provided.
- Improves error messages with actionable guidance for monorepo users.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In pnpm monorepos, NativeWind's own node_modules may contain a nested copy of tailwindcss (potentially v4) which differs from the version installed in the user's project. This causes three distinct failures:
Version check fails: The import of tailwindcss/package.json resolves from NativeWind's node_modules, detecting v4 and throwing 'NativeWind only supports Tailwind CSS v3' even when the project has v3 correctly installed.
loadConfig export missing: require('tailwindcss/loadConfig') resolves to the nested v4 copy which does not export this subpath, causing ERR_PACKAGE_PATH_NOT_EXPORTED errors.
Config path resolution: The default tailwind.config path is resolved relative to cwd, which in monorepo setups (where you run from the workspace root) points to the wrong directory.
This commit fixes all three issues: