Registry /
serialization / babel-plugin-pegjs-inline-precompile
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslnode 18–226 runs
build_error
glibcnode 18–226 runs
build_error
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
peg
✓ import peg from 'pegjs-inline-precompile';
✗ import { peg } from 'pegjs-inline-precompile';
Default export, not a named export.
peg
✓ const peg = require('pegjs-inline-precompile');
✗ const { peg } = require('pegjs-inline-precompile');
CommonJS require returns the default as the module exports object.
plugin
✓ // .babelrc
{ "plugins": ["babel-plugin-pegjs-inline-precompile"] }
✗ { "plugins": ["pegjs-inline-precompile"] }
Plugin name must be the full package name; omitting 'babel-plugin-' prefix is a common mistake.
Shows installation, Babel configuration, and usage of the peg tagged template literal for inline PEG.js grammar precompilation.
// Install dependencies
// npm install babel-plugin-pegjs-inline-precompile pegjs pegjs-inline-precompile
// .babelrc
{
"plugins": ["babel-plugin-pegjs-inline-precompile"]
}
// source.js
import peg from 'pegjs-inline-precompile';
const parser = peg`
// Grammar
Expression = Term ("+" Term)*
Term = Number ("*" Number)*
Number = [0-9]+
`;
export default function evaluate(input) {
return parser.parse(input);
}
Errors
Common errors & fixes
Module not found: Can't resolve 'pegjs-inline-precompile'
Missing runtime package dependency.
fixRun 'npm install pegjs-inline-precompile' and add to dependencies.
Error: The 'pegjs-inline-precompile' plugin requires a matching runtime package, but it is not loaded.
Babel plugin unable to locate the runtime module.
fixInstall 'pegjs-inline-precompile' and ensure it is resolvable in node_modules.
ReferenceError: peg is not defined
Missing import of 'peg' from 'pegjs-inline-precompile'.
fixAdd 'import peg from 'pegjs-inline-precompile';' at top of file.
Audit
Dependencies
pegjsoptionalPEG.js dependency for grammar parsing and code generation
pegjs-inline-precompileoptionalRuntime helper required for the `peg` tagged template literal