Compile-time styling (StyleX) can't see styles declared in .rx: imports are aliased and top-level bindings live inside the module factory
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 初心者へのやさしさ
- 35/100
- issue の種類
- 機能追加
- 明瞭さ
- おおむね明確
- 活発さ
- 活発
- 技術スタック
- typescript
- 領域
- build-system
調査の方向性
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.
索引モデルが issue の本文から書いたものです。
説明
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.
- 主要言語
- TypeScript
- スター
- 127
- フォーク
- 7
- 平均マージ
- 15時間 42分
- マージ済み PR(30日)
- 63
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
solidjs/reactivescript のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
solidjs/reactivescript#96 ·
メンテナーはふだん 1 日以内に返信
-
Vite front end keeps serving a failed build after the missing/broken imported module is fixed対応中かも @cgaaf が 1 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 77/100
solidjs/reactivescript#84 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
solidjs/reactivescript#77 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
solidjs/reactivescript#74 ·
メンテナーはふだん 1 日以内に返信
-
難易度 3/5 1〜2日 初心者へのやさしさ 62/100
solidjs/reactivescript#97 ·
メンテナーはふだん 1 日以内に返信
solidjs/reactivescript の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
GetStream/stream-chat-react#3467 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
vercel-labs/ui#1139 ·
メンテナーはふだん 1 日以内に返信
-
generate_image reference URL guard lets through IPv4-mapped IPv6 hosts and 100.64.0.0/10対応中かも @goranai が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
メンテナーはふだん 1 日以内に返信
-
bot:ai-assisted component:platform-js status:untriaged
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
midnightntwrk/platform-js#93 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100