Skip to content
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

Feat: implement vite plugin #66

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from
Draft

Conversation

nonzzz
Copy link
Contributor

@nonzzz nonzzz commented Dec 6, 2023

The PR is for implement a vite plugin. #47

Currently, @HorusGoul has already implemented it. But it can't cover many sences. like css process by vite, #44 and etc.

CheckList

  • Complete plugin.
  • Add unit test.
  • Add vite-example.

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Dec 6, 2023
@umutbozdag
Copy link
Contributor

Maybe you can make it draft since unit test is not ready yet. @nonzzz

@nmn nmn marked this pull request as draft December 6, 2023 22:26
@nmn
Copy link
Contributor

nmn commented Dec 6, 2023

Thanks for this PR! Vite support is one of the most requested features already.

Other than the missing unit tests, I don't think it solves the problem of generating CSS bundles in dev mode?

If we can make frameworks like Qwik and Astro work with this plugin, we should include examples for those as well.

@lilnasy
Copy link

lilnasy commented Dec 9, 2023

Thanks a lot for this effort! I implemented an integration for astro: astro-stylex. Would love to see this land so it can hopefully be made even better .

@nmn
Copy link
Contributor

nmn commented Dec 9, 2023

Great stuff @lilnasy !

@nmn
Copy link
Contributor

nmn commented Dec 9, 2023

I worked with a friend from the Qwik.JS team and got a custom Vite plugin working with a Qwik app: https://github.com/nmn/qwik-stylex

This plugin is able to handle generating and injecting CSS during development without runtime injection. With perhaps a few tweaks, this should enable a fairly universal Vite plugin.

@nonzzz
Copy link
Contributor Author

nonzzz commented Dec 19, 2023

@nmn I got some error the message is Uncaught SyntaxError: The requested module '/@fs/E:/self/stylex/packages/stylex/lib/stylex-inject.js' does not provide an export named 'default'

I noticed this #163 and my runtimeInjection is false.

@nonzzz
Copy link
Contributor Author

nonzzz commented Dec 19, 2023

The interesting thing is that it works fine in my own repo :)

@nmn
Copy link
Contributor

nmn commented Dec 19, 2023

This is an issue with ESM. Your plugin probably depends on StyleX publishing real ESM. We already have a PR for this, so we can see if rebasing after that PR fixes the issue.

@lifeiscontent
Copy link

@nmn any updates on getting a stylex vite plugin in the main repo? I've been having issues with @stylexjs/cli with remix as well as https://github.com/HorusGoul/vite-plugin-stylex (I get errors about insertNode when transitioning between pages)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants