# kentcdodds/babel-plugin-preval

🐣 Pre-evaluate code at build-time

Repository: https://github.com/kentcdodds/babel-plugin-preval
Canonical: https://ross.abutalabs.com/products/babel-plugin-preval
Homepage: https://npm.im/babel-plugin-preval
Language: TypeScript
License: MIT
License Family: permissive
Last push: 2022-02-02T22:07:10+00:00

## Health v2 (maintenance only)
Score: 23/100 (v2, computed 2026-09-03T02:20:16.233290+00:00)
- activity 0, release rhythm 8, longevity 100
- inputs: {"age_days": 3346, "days_push": 1673, "days_rel": null, "gap_med": null, "n_releases_24m": 0}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 1363, forks 48 (observed 2026-08-28T04:04:30.419130+00:00)

## What it is
A Babel plugin that pre-evaluates JavaScript code at build time, replacing expressions with their computed results. It lets you run Node.js code (like filesystem reads) during compilation and inline the exported value into your bundle.

## Use cases
- inline file contents into a bundle at build time
- run node code during compilation instead of runtime
- read the filesystem in browser-targeted code
- precompute constants at build time
- evaluate code with babel-plugin-macros

## When to avoid
- your build does not use Babel
- the evaluated code depends on runtime state
- you need evaluation in non-JavaScript toolchains like Vite or esbuild without Babel

## Facets
- artifact type: plugin
- maturity: maintenance
- function: compiler, build-tool, developer-tools
- domain: developer-tools, web-development, frontend
- platform: -
- tags: babel-plugin, build-time-evaluation, precompile, babel-plugin-macros, nodejs, javascript

## Member repositories
- kentcdodds/babel-plugin-preval (main) score 23

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:04:30.419130+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-30T04:41:25.198093+00:00, confidence not recorded.
  - readme: https://github.com/kentcdodds/babel-plugin-preval (fetched 2026-08-28T04:04:30.419130+00:00, sha 6c7cc50956fc)
  - registry_npm: https://registry.npmjs.org/babel-plugin-preval (fetched 2026-08-29T11:59:11.037368+00:00, sha e7f6df044000)
- Data as of 2026-08-30T08:39:29.467469+00:00.
