Preval.macro
Pre-evaluate code at build-time with babel-macros
Install / Use
/learn @kentcdodds/Preval.macroREADME
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).
Related Skills
node-connect
350.8kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
110.4kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
350.8kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
350.8kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
