Skip to content

Add rspack build tooling for primer-miso frontend#1393

Closed
dhess wants to merge 8 commits intomainfrom
codex/add-package.json-and-npm-scripts
Closed

Add rspack build tooling for primer-miso frontend#1393
dhess wants to merge 8 commits intomainfrom
codex/add-package.json-and-npm-scripts

Conversation

@dhess
Copy link
Copy Markdown
Member

@dhess dhess commented Nov 9, 2025

Summary

  • add an npm package manifest for the primer-miso frontend with rspack build scripts
  • record the npm lockfile so the rspack toolchain resolves reproducibly
  • ignore the local node_modules directory in the primer-miso workspace

Testing

  • npm install

Codex Task

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread primer-miso/package.json Outdated
Comment on lines +5 to +9
"scripts": {
"build": "rspack build --mode=development",
"build:prod": "rspack build --mode=production",
"watch": "rspack watch",
"serve": "rspack serve"
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Define rspack entry for frontend assets

The npm scripts call rspack with its default configuration, which looks for ./src/index.js. Primer-miso’s browser code resides in the frontend/ directory and no rspack.config.* was introduced, so running npm run build or npm run serve will error because the expected entry file does not exist. Point the scripts at frontend/index.js (or add a config) so the new build tooling actually runs.

Useful? React with 👍 / 👎.

@dhess
Copy link
Copy Markdown
Member Author

dhess commented Nov 10, 2025

@codex review

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread primer-miso/frontend/index.js Outdated
Comment on lines +15 to +24
const wasmUrl = new URL("./bin.wasm", import.meta.url);
const ghcModule = await import(/* webpackIgnore: true */ ghc_wasm_jsffiUrl);
const ghc_wasm_jsffi =
ghcModule && typeof ghcModule === "object" && "default" in ghcModule ? ghcModule.default : ghcModule;
if (typeof ghc_wasm_jsffi !== "function") {
throw new Error("Failed to load ghc_wasm_jsffi module");
}

const instance_exports = {};
const { instance } = await WebAssembly.instantiateStreaming(fetch("bin.wasm"), {
const { instance } = await WebAssembly.instantiateStreaming(fetch(wasmUrl), {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Reference generated Wasm at its actual path

The build script now writes the compiled module to frontend/generated/bin.wasm (see build-frontend.sh), but the bundled frontend still resolves new URL("./bin.wasm", import.meta.url) here. Rspack statically resolves new URL() calls during compilation, so it will look for frontend/bin.wasm and abort the build with a "Module not found" error because that file is never created. Update the import to point at ./generated/bin.wasm (or copy the file to the expected location) so the bundler can locate the artifact.

Useful? React with 👍 / 👎.

@dhess
Copy link
Copy Markdown
Member Author

dhess commented Jan 26, 2026

I was considering the Miso UI approach of using Tailwind, ShadCN, Basecoat, and TweakCN for a Primer design system, in which case, as far as I understand it, it'd be nice to have a proper bundler so that we don't have to rely on loading pre-baked shims and stylesheets from CDNs. rspack seems like a solid modern choice.

However, upon further reflection, I think it's a bit mad to pull in this many frameworks/libraries/whatever just to avoid writing some CSS. I may change my mind later if dealing with browser quirks etc. becomes too painful, but for now, let's drop this approach and stick with raw CSS and Haskell as we currently do.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant