facebook / stylex

StyleX is the styling system for ambitious user interfaces.
https://stylexjs.com
MIT License
8.34k stars 307 forks source link

Unable to run StyleX with Next.js #606

Closed steida closed 3 months ago

steida commented 3 months ago

Describe the issue

TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received undefined

I'm using Stylex in another project, but today, I tried to add it to a new Next.js project, following the docs and trying apps/nextjs-example and https://github.com/nmn/nextjs-app-dir-stylex, but without success. So many errors.

Expected behavior

Working Next.js example or accurate docs at least.

Steps to reproduce

As described.

Test case

No response

Additional comments

I love StyleX, but it's so hard to set up that it kills adoption, I suppose.

steida commented 3 months ago

For example, which babel config should I use? There are three different (docs, apps/nextjs-example, nmn/nextjs-app-dir-stylex.

steida commented 3 months ago

I see an old PR: https://github.com/facebook/stylex/pull/499. No action for months. Is there a reason for that?

steida commented 3 months ago

Feel free to close it as "not actionable". You are probably aware of that anyway.

nmn commented 3 months ago

The next JS situation will be changing shortly.

tiredpyrx commented 3 months ago

I loved the documentation about library itself but integrations with other libraries and frameworks are little to none. I atleast expected to use it with Next without hassle when I saw there is an actual example of it, it did require some time to integrate. Still loving it though, so I guess I will just wait until a documentation update about library & framework integrations.

6qat commented 3 months ago

No documentation for Vite projects either.

nonzzz commented 3 months ago

@6qat There is not a good way for vite. If you're a spa user.You can follow the ecosystem to integrate. Currently. SSR is a hard work to do.

besSejrani commented 3 months ago

Hi @nmn ,

First, I would like to express my gratitude to you and the Stylex team for creating such an excellent product.

I am interested in knowing when the CLI for Next.js will be available. I've been using Stylex since December, but my current project requires compatibility with Next.js. I prefer not to use any tools other than Stylex, but if the feature is expected to be released in a year, I would appreciate to know.

Jta26 commented 3 months ago

Hey, The CLI has been merged into the main branch, and it's currently in a usable state. I would actually appreciate someone to try and use it and maybe give some feedback on it.

You can view some minimal documentation on it here https://github.com/facebook/stylex/tree/main/packages/cli

besSejrani commented 3 months ago

@Jta26 , I followed the documentation you provided, but it appears that the @stylexjs/cli package does not exist on npm and cannot be installed.

Jta26 commented 3 months ago

Ahh sorry, I think we haven't actually cut a release for it yet to npm. To use the CLI right now you'll have to manually pull down the repo

besSejrani commented 3 months ago

I noticed that you released the CLI today. However, when I tried to install it, I encountered the following error from NPM

ERR_PNPM_FETCH_404  GET https://registry.npmjs.org/@stylexjs%2Fscripts: Not Found - 404

This error happened while installing the dependencies of @stylexjs/cli@0.7.0

@stylexjs/scripts is not in the npm registry, or you have no permission to fetch it.
javascripter commented 3 months ago

I noticed that you released the CLI today. However, when I tried to install it, I encountered the following error from NPM

ERR_PNPM_FETCH_404  GET https://registry.npmjs.org/@stylexjs%2Fscripts: Not Found - 404

This error happened while installing the dependencies of @stylexjs/cli@0.7.0

@stylexjs/scripts is not in the npm registry, or you have no permission to fetch it.

Can confirm the CLI can't be installed because of this error. Could you you publish @stylexjs/scripts that we can test the CLI? @nmn

v0.7.4 has been released and the CLI works now!

"@stylexjs/cli": "^0.7.4",
nmn commented 3 months ago

Yes, 0.7.4 mostly fixes the problem. You still need to manually add yargs as a dependency for now. Will fix this in 0.7.5