Compile-time styling (StyleX) can't see styles declared in .rx: imports are aliased and top-level bindings live inside the module factory
Les mainteneurs répondent en général sous 1 jour
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 5/5
- Temps estimé
- Plus d'une semaine
- Accessibilité débutants
- 35/100
- Type d'issue
- Fonctionnalité
- Clarté
- Plutôt claire
- Activité
- Active
- Stack technique
- typescript
- Domaine
- build-system
Piste de recherche
Read the @solidjs/vite-plugin frontend transform hook and the compiler output that aliases imports and moves top-level declarations into the module factory. Check whether the proposed module-scope form can be emitted for .rx and then seen by a compile-time styling plugin. Done means the issue’s question is resolved, with either a supported integration path or documentation of the sibling .ts workaround in guide/libraries.md.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
Compile-time styling libraries can't see styles written in .rx. StyleX is the case we hit; vanilla-extract, Panda and similar tools have the same constraint.
What happens
import pure { attrs, create } from "@stylexjs/stylex"
local = create({ hint: { color: "red" } })
export component Hint() {
<p {...attrs(local.hint)}>hint</p>
}
rxc check passes. In the browser: Unexpected 'stylex.create' call at runtime. Styles must be compiled by '@stylexjs/babel-plugin', and Solid halts the reactive system (REACTIVITY_HALTED).
Why
Two things stack:
- No plugin sees the lowered code in time.
@stylexjs/unpluginisenforce: 'pre'and only transforms JS-like ids..rxbecomes JS inside@solidjs/vite-plugin'stransform(thefrontendshook), after everypreplugin has already passed over the raw.rxtext. - Even if one did, the output isn't analyzable. Compile-time styling needs
create({...})at module top level, with literal arguments and the import binding used directly. The crate's output aliases every import (import { create as w$create }…const v$create = w$create) and moves every top-level declaration insideexport default function module(__rt) { … }, wherelocalis a__rt.memo.
Today's workaround (works)
Declare styles in a sibling .ts module and import the compiled object: import pure { s } from "./form.styles", then attrs(s.form, props.styles). Recipe functions from a StyleX design system (import pure { button } from "…/stylex/button") also work unchanged. We verified this end to end with SSR and hydration on Solid 2.0.0-rc.21, @solidjs/vite-plugin 3.0.0-next.57 and compiler/runtime 0.3.1.
Suggestion
- A module-scope form that lowers verbatim. For example, a top-level binding whose right-hand side is a call to an imported
purefunction with literal arguments (or an explicit keyword) is emitted outside the module factory, and the import it calls stays unaliased. Styling compilers could then process.rxoutput the way they process.tsx. - Plugin ordering, in
@solidjs/vite-plugin. Let other plugins see a frontend's lowered JS. For example, lower inload, or document a hook point a styling plugin can run after. This depends on the first point; on its own it doesn't help.
Is compile-time CSS-in-JS a goal for .rx? Or is the scoped <style> (spec/07 CSS-1…5) the intended answer, with a sibling .ts for StyleX? Either answer is useful; if the latter, a line in guide/libraries.md would save the next person the runtime crash.
- Langage dominant
- TypeScript
- Étoiles
- 127
- Forks
- 7
- Merge moyen
- 15 h 42 min
- PR mergées (30 j)
- 63
Préparer son environnement
- Aucun Dockerfile ni fichier Docker Compose
- Aucun modèle de pull request
- Lire le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de solidjs/reactivescript
-
Difficulté 2/5 1-3 heures Accessibilité débutants 84/100
solidjs/reactivescript#96 ·
Les mainteneurs répondent en général sous 1 jour
-
Vite front end keeps serving a failed build after the missing/broken imported module is fixedPeut-être pris @cgaaf l’a pris il y a 1 jour. Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 77/100
solidjs/reactivescript#84 ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 76/100
solidjs/reactivescript#77 ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
solidjs/reactivescript#74 ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 3/5 1-2 jours Accessibilité débutants 62/100
solidjs/reactivescript#97 ·
Les mainteneurs répondent en général sous 1 jour
Toutes les issues de solidjs/reactivescript
Issues similaires
-
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
GetStream/stream-chat-react#3467 ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
vercel-labs/ui#1139 ·
Les mainteneurs répondent en général sous 1 jour
-
generate_image reference URL guard lets through IPv4-mapped IPv6 hosts and 100.64.0.0/10Peut-être pris @goranai l’a pris aujourd’hui. Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 75/100
Les mainteneurs répondent en général sous 1 jour
-
[Bug] IntegerRange.contains counts a non-integer just above max as inside an inclusive rangeOuvertebot:ai-assisted component:platform-js status:untriaged
Difficulté 2/5 1-3 heures Accessibilité débutants 82/100
midnightntwrk/platform-js#93 ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 66/100