-
Notifications
You must be signed in to change notification settings - Fork 85
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
CommonJS Support #93
CommonJS Support #93
Conversation
Code looks pretty good. You can fix the CI failure by running Can you think of a way to write a test that would prevent a regression? I'm wondering if a few months or years down the road me, or some contributor shuffled files around, or pulled in |
also, i checked out your PR branch and released another beta version. you can install and test with |
Perfect, testing |
Works! Now, it creates a temporary directory under |
thanks, this looks really good. i'm hoping to check it out locally and do some testing with it this afternoon, and then hopefully merge. is the babel plugin you're working on an open source project? or is it embedded in some other app? I'd be interested in looking at it if it was open source. |
Yes absolutely! Want to polish some things and add docs before publishing however, so it's not public yet. Any chance you could publish a new release with the most recent commit I added to this branch? Though it seemed it was working out of the box on all platforms, it still produced some errors without the |
Done, 2.1.0-beta.5 is out, install with |
sent your PR a PR with a proposed simplification of the node compat test, let me know your thoughts when you have a sec: |
move test for node commonjs compat into gh action ci
Yeah, that's much better than having it in a jest test, merged into this PR! |
FYI, just published the babel macro here: react-native-tailwind.macro 🎉 |
hey, i got this error/warning when testing the latest set of changes by installing a new beta build into a test RN app:
I'm not super familiar with the stuff you did with the package.json exports field. Do you know why I'd be getting this error? |
looks like it might be an issue with react-native, see: react-native-community/cli#1168 and uuidjs/uuid#444 for some more context. non-web RN is the main target of this library, so I definitely want that path to be the happy path and work without any funkiness or warnings. it might be enough to just supply a path, like here: tobua/epic-mobx@4645f51 |
i tried adding |
I'm running 2.1.0-beta.5 in an Expo project without any issues. 🤔 |
Just realized that it's complaining about the |
good thought on the |
Just tried against a fresh Here's what I'm doing in my App.js: import React from 'react';
import { View } from 'react-native';
import tw from 'twrnc';
const App = () => <View style={tw`flex-1 bg-blue-500`} />;
export default App; |
can you try creating a customized version of the const tw = create(require(`../tailwind.config`)); |
No problem either. I'm running plain JS however, for some reason I keep getting errors bootstrapping a TS project, so can't confirm with TS yet. |
Finally got a new TS project up and running and also no issues... import React from 'react';
import {View} from 'react-native';
import {create, useDeviceContext} from 'twrnc';
const tw = create(require('./tailwind.config'));
const App = () => {
useDeviceContext(tw);
return <View style={tw`flex-1 bg-blue-500`} />;
};
export default App; |
Do you have the package installed via npm or linked locally, btw? Have had some troubles with that in the past. |
Ack, shoot, I figured it out. I had a random dir lying around in my app root directory from some debugging I had been doing, and for some reason metro was getting super confused and poking around in there. When I removed that, it started working. Sorry to waste your time. I still think the However, I'm going to be unavailable the rest of this week, so I think i'm going to hold off publishing a non-beta version until next week. Hopefully you're OK depending on the beta release until then. Your babel macro library looks really slick! Nice work. 👍 |
Yes, good call on the package.json. Sounds good to me! |
merged. thanks for your work on this. i'll get a release out shortly. 👍 |
|
This PR builds on #91 and removes the
react-native
dependency from thecreate
function. Thecreate
function now also requires passing in the device platform as second parameter.To stay backwards-compatible, we construct and export a new
create
function that injects the current platform and matches the previous function signature inindex.ts
, keeping the original function unaware ofreact-native
.With these changes, we can now import a node-compatible version using
import create from "twrnc/create"
.Closes #92.