Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions build.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -220,11 +220,11 @@ async function runWebpack(isWithoutKatex, isWithoutTiktoken, minimal, sourceBuil
}),
...(isWithoutKatex
? [
new webpack.NormalModuleReplacementPlugin(/markdown\.jsx/, (result) => {
new webpack.NormalModuleReplacementPlugin(/math-plugin\.mjs/, (result) => {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removing the markdown.jsx swap means the no-katex variant now compiles the real markdown.jsx, whose three CSS imports (@aeven-ai/hypermarkdown/styles.css, tippy.js/dist/tippy.css, ./mykatex.min.css) land in the shared chunk — ./src/components is added to that entry when isWithoutKatex (build.mjs:132). Webpack emits that chunk's CSS as shared.css, but finishOutput only copies content-script.css/popup.css, so the renderer stylesheet is silently dropped from both *-without-katex-and-tiktoken artifacts while their JS still ships the renderer.

Technical details
# Minimal variants lose the renderer stylesheet

## Affected sites
- `build.mjs:223` — the replacement now only targets `math-plugin.mjs`; nothing keeps `markdown.jsx`'s CSS out of the shared chunk or into the copied set.
- `build.mjs:132``shared.push('./src/components')` for `isWithoutKatex` puts the whole components tree (and its CSS) in the shared chunk.
- `build.mjs:543-570``commonFiles` copies `content-script.css` and `popup.css` only; `shared.css` is not in the list and no HTML references it.

## Evidence
- Clean `npm run build` with the webpack cache cleared:
  - `grep -c hypermarkdown build/chromium-without-katex-and-tiktoken/content-script.css``0`; `build/chromium/content-script.css``301`. `--hm-font` and `tippy` are likewise absent in the minimal build.
  - `shared.css` is present in the no-katex webpack cache asset list
    (`node_modules/.cache/webpack/webpack-no-katex__no-tiktoken__minimal__*`), listing `content-script.css`, `popup.css`, `IndependentPanel.css`, `shared.css`, but no `shared.css` exists under `build/chromium-without-katex-and-tiktoken/`.
  - The renderer JS is still in the minimal `shared.js` (`Thinking Content` / `hypermarkdown` strings present), so only the CSS is lost.
- The full build routes the renderer CSS into `content-script.css` because its components are not in the shared entry.

## Required outcome
- The `-without-katex-and-tiktoken` artifacts must ship the renderer's CSS (or must not emit it into an unshipped chunk), so the new markdown/reasoning UI is styled the same as the full build.

## Suggested approach (optional)
- Add any emitted `shared.css` to `finishOutput`'s `commonFiles` and reference it from `src/popup/index.html` / `src/pages/IndependentPanel/index.html`; or keep the renderer CSS import out of the `shared` entry (for example import it from a module only reachable from the content-script entry); or restore a CSS-free renderer module for the minimal variant.
- Re-run `npm run build` and assert the minimal `content-script.css` contains `.hypermarkdown` (and not `katex`) before relying on the current validation.

if (result.request) {
result.request = result.request.replace(
'markdown.jsx',
'markdown-without-katex.jsx',
'math-plugin.mjs',
'math-plugin-without-katex.mjs',
Comment on lines +223 to +227
)
}
}),
Expand All @@ -236,7 +236,6 @@ async function runWebpack(isWithoutKatex, isWithoutTiktoken, minimal, sourceBuil
// Disable symlink resolution for consistent behavior/perf; enable via BUILD_RESOLVE_SYMLINKS=1 when working with linked deps
symlinks: resolveSymlinks,
alias: {
parse5: path.resolve(__dirname, 'node_modules/parse5'),
...(minimal
? { buffer: path.resolve(__dirname, 'node_modules/buffer') }
: {
Expand Down
Loading