rstackjs / rstackjs/rstack-examples

StyleX example doesn't setup styles correctly

オープン
#356 コメント 6 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

主要言語
TypeScript
スター
168
フォーク
47
平均マージ
3時間 45分
マージ済み PR(30日)
11

説明

(1) Files generated by rsbuild stylex example do not use the stylex.css file.
Instead styles are present because of StyleX runtimeInjection=true feature, which should be disabled for production builds,

(2) yet apparently it is enabled for production builds
(production builds being considered the result of rsbuild build command, i.e. "build" script in package.json)

and if runtimeInjection is force-disabled like this:

  tools: {
    rspack: {
      plugins: [stylexPlugin({
        stylex: {
          runtimeInjection: false,
        }
      })],
    },
  },

then styles are not loaded by the browser at all

The unplugin-stylex rsbuild example solves this by embedding the <link rel="stylesheet" href="stylex.css"> to the template index.html

(3) As a result, the output.inlineStyles=true doesn't work for the stylex.css file generated by the plugin.
(the reason I wrote this github-issue is because of this third problem)

Git repo to reproduce: https://github.com/mechan1sm/stylex-bug-reproduce-1

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

Start with the rsbuild/stylex example, its package.json build script, and the generated stylex.css referenced in the report. Reproduce with rsbuild build, then compare the production HTML and CSS output with the linked unplugin-stylex example's public/index.html. Done means production styles load without runtime injection and output.inlineStyles handles stylex.css as intended.

索引モデルが issue の本文から書いたものです。

評価

技術スタック
typescript
領域
build-system, frontend
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
42/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。