Registry / devops / rollup-plugin-ecma-version-validator

rollup-plugin-ecma-version-validator

JSON →
library0.2.13jsnpmunverified

A Rollup plugin that verifies the ECMAScript version of bundle files by checking syntax against a specified target (default ES5). It uses Acorn under the hood to parse the output and reports any syntax features that exceed the target version. This is useful for ensuring production bundles don't include unsupported syntax for older environments. The current stable version is 0.2.13, with infrequent releases. It supports Rollup ^2.16.1 and ^3.x. Unlike other ECMAScript compliance tools, this plugin integrates directly into the Rollup build pipeline and runs on the final bundle, not on source files.

npm install rollup-plugin-ecma-version-validator
INSTALL
IMPORT
SIG · ROLLUP-PLUGIN-ECMA
R
rollup-plugin-ecma-version-validator
devopsjavascriptv0.2.13
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
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
musl
node 18223 runs
build_error
glibc
node 18223 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

ecmaVersionValidator
import { ecmaVersionValidator } from 'rollup-plugin-ecma-version-validator'
import ecmaVersionValidator from 'rollup-plugin-ecma-version-validator'
This package exports a named function, not a default export.
EcmaVersionValidatorOptions
import type { EcmaVersionValidatorOptions } from 'rollup-plugin-ecma-version-validator'
import { EcmaVersionValidatorOptions } from 'rollup-plugin-ecma-version-validator'
This is a TypeScript type import, not a runtime value.
plugin via require
const { ecmaVersionValidator } = require('rollup-plugin-ecma-version-validator')
const ecmaVersionValidator = require('rollup-plugin-ecma-version-validator')
Do not use default require; the full export is an object.

Basic usage of the plugin to validate that the bundle only contains ES5 syntax.

// rollup.config.js import { ecmaVersionValidator } from 'rollup-plugin-ecma-version-validator'; export default { input: 'src/index.js', output: { file: 'dist/bundle.js', format: 'iife' }, plugins: [ ecmaVersionValidator({ ecmaVersion: 5 }) ] };
Debug
Known issues
gotchaThe plugin only validates the final bundle output, not the source files. If you use code splitting or multiple outputs, each output will be validated separately, but the plugin must be applied per output config or globally.
fix
Ensure the plugin is included in the plugins array for the outputs you want to validate.
affects: >=0.1.0
gotchaThe default ecmaVersion is 5 (ES5), which is very restrictive. If your code uses modern syntax (async/await, arrow functions, etc.), it will fail validation unless you explicitly set ecmaVersion higher.
fix
Set ecmaVersion to the target version you actually need, like 2020 for ES2020.
affects: >=0.1.0
deprecatedThe option 'acornOptions' is no longer supported; Acorn parsing is internal. Custom Acorn options cannot be passed.
fix
Remove acornOptions from the options object. Use ecmaVersion only.
affects: >=0.2.0
breakingv0.2.0 removed support for Rollup 1.x. Peer dependency changed to rollup ^2.16.1 || ^3.x.
fix
Upgrade to Rollup ^2.16.1 or ^3.x. If stuck on Rollup 1.x, stay on v0.1.x.
affects: >=0.2.0 <0.3.0
gotchaThe plugin does not handle dynamic imports or code splitting across multiple output files; each file is validated independently. If you use dynamic imports, the plugin may fail on the main chunk if it contains dynamic import() syntax not supported by the target ecmaVersion.
fix
Set ecmaVersion high enough to support dynamic imports (ES2020 or later) or disable validation for chunks that contain dynamic imports.
affects: >=0.1.0
Errors
Common errors & fixes
Error: [ECMA Version Validator] Unexpected token (1:5)
The bundle contains syntax not valid for the target ECMAScript version. For example, arrow functions in an ES5 target.
fix
Either set ecmaVersion to a higher version (e.g., 2020) or use a transpiler like Babel before Rollup to transform the code.
Error: Cannot find module 'rollup-plugin-ecma-version-validator'
The package is not installed or is missing from node_modules.
fix
Run `npm install --save-dev rollup-plugin-ecma-version-validator`.
TypeError: ecmaVersionValidator is not a function
Default import was used instead of named import.
fix
Change import to `import { ecmaVersionValidator } from 'rollup-plugin-ecma-version-validator'`.
Upgrade
Version history
0.2.13latest on npm
Audit
Dependencies
rolluprequiredThis is a Rollup plugin; it requires Rollup as a peer dependency.
Agent activity
6 hits · last 30 days
node
4
Amazon
1
Resources
rollup-plugin-ecma-version-validator — npm install rollup-plugin-ecma-version-validator · libregistry