-
Notifications
You must be signed in to change notification settings - Fork 26
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
Merge behave-flow as a package @behave-graph/react-flow #166
Conversation
@oveddan @beeglebug I do not know how to configure preconstruct to compile the TSX files in the |
You need to have babel use the @babrel/preset-react plugin. If you want it to only be used in that package, you would need to have a babel config in that package folder. See the .babelrc file in my branch: Youre going to run into other issues with the css files, which I discussed in the other PR; not sure the best solution for that one. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you don't need to import react
if you have the right typescript settings.
You can add to the tsonfig
(in compilerOptions
):
"jsx": "react-jsx"
and you get the newer JSX Transform which also has performance enhancements.
So I would recommend adding a tsconfig here that extends the root one ut adds that setting, and removing the import react
everywhere.
Example:
{
"extends": "../tsconfig.json",
"compilerOptions": {
"jsx": "react-jsx"
},
"include": ["./src"]
}
fwiw i'm still not convinced the package should be called |
Edit: Ignore all that, i forgot i was running an older version of npm, swapped to latest and the symlinks worked as expected 🤦 |
i've got almost everything working now, it all builds, and i can serve the graph-editor with but now it dies because of css, and it looks like preconstruct just flat out doesnt support css (see preconstruct/preconstruct#268) not sure how we move past this, i've tried css modules instead of tailwind, but the same problem happens the only way i can think of for now is to manually create a css file and use global class names in the components, but that feels so janky |
i've just noticed it also fails with a |
@beeglebug is there a different build system we could use rather than preconstruct? I guess we could go back to the more manual tsc+rollup system you had earlier? |
it looks like everyone uses lerna https://npmtrends.com/@preconstruct/cli-vs-lerna |
With The issue isn't with preconstruct - preconstruct just calls babel to build the js and symlinks it with minimal configuration; nowhere in babel's documentation do they mention building css - because it's not really meant for that and you shouldn't really be bundling css with your js files (I haven't seen many packages that do that). Both Reactflow, tailwind, and rainbowkit - method of css integration is by asking you to import the css. They all use a separate Same thing can be done in this package. See my PR where |
The one thing rollup would be able to do would be call postcss as a separate step from the babel build. You could do things this way but then would want to add the step to use |
It wasnt really a
Nobody has suggested doing that, we want to use css modules, but generate a separate css build file and tell users to include it (exactly as other packages do) |
if the build system had support for css, then it could be done automatically in one step, we could use css modules in react and get all the benefits that come with that, instead of going old school and having two build steps |
yeah that could work...just requires setting up rollup. I've also seen this being used: |
Doesn't preconstruct use rollup under the hood? It's a shame it's not fully
configurable, there's multiple issues like the one I linked where they
basically wash their hands of CSS.
…On Thu, 24 Nov 2022, 15:01 Dan Oved, ***@***.***> wrote:
if the build system had support for css, then it could be done
automatically in one step, we could use css modules in react and get all
the benefits that come with that, instead of going old school and having
two build steps
yeah that could work...just requires setting up rollup. I've also seen
this being used:
https://vanilla-extract.style/documentation/getting-started/
—
Reply to this email directly, view it on GitHub
<#166 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAHJAMDTFXTKF6RMXW5PMYTWJ57K7ANCNFSM6AAAAAASJIU73I>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
yes they do use rollup and it would be nice if you could configure it |
Here's a list of css-in-js frameworks, implementing one of them would probably solve this problem |
I think at this stage I'd be more comfortable with a plain CSS solution
rather than adopting a new CSS in JS framework.
Really the amount of styles in this package is small, so it's a shame this
is such a sticking point
…On Thu, 24 Nov 2022, 15:18 Dan Oved, ***@***.***> wrote:
Doesn't preconstruct use rollup under the hood? It's a shame it's not
fully configurable, there's multiple issues like the one I linked where
they basically wash their hands of CSS.
yes they do use rollup and it would be nice if you could configure it
—
Reply to this email directly, view it on GitHub
<#166 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAHJAMBAT2SVVXUC2YQVRQDWJ6BMLANCNFSM6AAAAAASJIU73I>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
The fact that there is a minimal amount of css should make it easy to just declare it a different way, and a lot less work and code change than having to configure rollup for each package, and then postcss for this one. I'd be glad to work on this. |
Ideally the compiled CSS for this package would contain the base react-flow
stylesheet so we don't need to tell users to add two important theirs and
ours.
Any idea how we would go about that with a CSS in JS solution?
…On Thu, 24 Nov 2022, 15:28 Dan Oved, ***@***.***> wrote:
The fact that there is a minimal amount of css should make it easy to just
declare it a different way, and a lot less work and code change than having
to configure rollup for each package, and then postcss for this one.
—
Reply to this email directly, view it on GitHub
<#166 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAHJAMHB2CHIVKZE2KSYR5TWJ6CQHANCNFSM6AAAAAASJIU73I>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Yeah agreed - it would be nice if they can just import one stylesheet instead of having to import two. Will look into it. |
Having it as one css bundle could be done by declaring an index.css file and importing the reactflow styles and building it all with postcss.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't the graph-editor
example have a package.json
?
I made a few more changes and I have it loaded up in the graph-editor project with a package.json. Obviously missing CSS. Bad things:
I am definitely not an expert at any of this build stuff. help would be appreciated. I guess I can merge this and we can look to fix it going forward. |
Thank you @oveddan and @beeglebug for your help on this PR. I know it was a challenge. |
@beeglebug
This does not yet build.