-
-
Notifications
You must be signed in to change notification settings - Fork 237
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: Ensure Windows path compatibility in web platform transformation #860
base: main
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
@marklawlor We encountered the same issue on Windows as well, and the fix appears to be working as expected. 🙏 |
Same here. It would be great if it could be merged soon. By the way, great work by @marklawlor and all contributors, Nativewind is amazing |
@dmitryshostak how can i use this branch in my project now? I am blocked. |
Hi, @aaronksaunders. I think there are ways to install a dependency from a pull request / fork, but at least it didn't seem to work for me. I created this simple PHP script that applies the fix once the nativewind package has been installed. I run it whenever I install my front-end dependencies. You can easily translate the script to whatever language you prefer. <?php
$filePath = 'front-end/node_modules/nativewind/dist/metro/transformer.js';
$content = file_get_contents($filePath);
$issue = '`require(\'${config.nativewind.output}\');`';
if (! str_contains($content, $issue)) {
echo 'NativeWind fix already applied!';
return;
}
$fix = '`require(\'${config.nativewind.output.replace(/\\\\/g, \'\\\\\\\\\')}\');`';
$result = str_replace($issue, $fix, $content);
file_put_contents($filePath, $result);
echo 'NativeWind fix applied successfully!'; |
Inspired by @Alejandro-M-Cruz, I've created JavaScript instead. You can place it in the root directory of your project. To integrate this script with your application, add the following entry to your package.json. This will ensure the script runs every time you start your program:
Here is the JavaScript script:
This setup allows the fix.js script to batch process necessary adjustments automatically whenever you initiate your project with expo start. |
@rickychan0611 great! the only thing - I would add it to |
The script by @rickychan0611 works but in my end first install and run of the web script will cause the following error:
However, if I stop the server and run the web script again, it now works as normal. Anyone know why? |
You need to clear the cache when starting the server |
As native-wind is no longer maintained, I have switched to tailwind-react-native-classnames. It is also much faster |
This PR fixes an issue where Windows paths were not correctly handled in the Metro transformer's web platform transformation, causing incorrect runtime module resolution.
It's a duplicate of #854, but with a better naming so we don't break it again. ❗
@marklawlor could you please merge it ASAP as we're using
nativewind
in production and we hate to patch it :)The related issue - #784 (comment)