SkillAgentSearch skills...

Preval.macro

Pre-evaluate code at build-time with babel-macros

Install / Use

/learn @kentcdodds/Preval.macro
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

preval.macro

This is a babel-plugin-macros macro for babel-plugin-preval.

Please see those projects for more information.

Installation

This module is distributed via npm which is bundled with node and should be installed as one of your project's devDependencies:

npm install --save-dev preval.macro

You'll also need to install and configure babel-plugin-macros if you haven't already.

Usage

Once you've configured babel-plugin-macros you can import/require preval.macro. For example:

import preval from 'preval.macro'

const one = preval`module.exports = 1 + 2 - 1 - 1`

Note:

babel-plugin-preval allows you to have a few more APIs than you have with this macro, but this macro comes with all the benefits of using babel-plugin-macros (which you can read about in the babel-plugin-macros docs).

<!-- prettier-ignore-start --> <!-- prettier-ignore-end -->

Related Skills

View on GitHub
GitHub Stars126
CategoryDevelopment
Updated1mo ago
Forks6

Languages

JavaScript

Security Score

80/100

Audited on Mar 5, 2026

No findings