Skip to content

fix(build): inline hexColors in index.js for browser bundler compatibility#25

Open
chungty wants to merge 1 commit intomainfrom
fix/inline-hex-colors-for-browser-bundlers
Open

fix(build): inline hexColors in index.js for browser bundler compatibility#25
chungty wants to merge 1 commit intomainfrom
fix/inline-hex-colors-for-browser-bundlers

Conversation

@chungty
Copy link
Copy Markdown
Member

@chungty chungty commented Apr 13, 2026

Summary

The JS entry (`build/dist/index.js`) previously read `hex/colors.json` at runtime via `node:fs`, which fails in any browser-targeted bundler — Webpack, Vite (browser), Remotion — with:

```
UnhandledSchemeError: Reading from "node:fs" is not handled by plugins.
```

This blocks consuming `hexColors` from the Remotion scaffold in verdigristech/verdigris (Z2O-1029).

Fix

Inline the hex values directly into `index.js` at build time. No runtime filesystem dependency, so the package works everywhere: Node, SSR, Vite, Webpack, Remotion.

Public API

Unchanged. `hexColors` is still exported as `Record<string, string>`, same keys, same values.

Test plan

  • `npm run build` produces inlined `build/dist/index.js`
  • `head -5 build/dist/index.js` shows hex values, no `node:fs` import
  • Downstream smoke-test: Remotion render in verdigris-remotion consumes this without bundler error
  • Tag as `v0.6.0` after merge so consumers can pin

…ility

The JS entry previously read hex/colors.json at runtime via node:fs, which
fails in browser-targeted bundlers (Webpack, Vite browser, Remotion) with:

  UnhandledSchemeError: Reading from "node:fs" is not handled by plugins.

Now the build inlines the JSON values directly into index.js at build time,
so @verdigristech/design-tokens works in any environment — Node, SSR, Vite,
Webpack, Remotion — without runtime filesystem access.

Public API unchanged: `hexColors: Record<string, string>`.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 13, 2026

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: c035bca3-e32d-4d95-8532-6b8d694b97d4

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/inline-hex-colors-for-browser-bundlers

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant