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-validatorVerified import paths — ran on the pinned version, not inferred.
Basic usage of the plugin to validate that the bundle only contains ES5 syntax.
Ensure the plugin is included in the plugins array for the outputs you want to validate.
Set ecmaVersion to the target version you actually need, like 2020 for ES2020.
Remove acornOptions from the options object. Use ecmaVersion only.
Upgrade to Rollup ^2.16.1 or ^3.x. If stuck on Rollup 1.x, stay on v0.1.x.
Set ecmaVersion high enough to support dynamic imports (ES2020 or later) or disable validation for chunks that contain dynamic imports.
Either set ecmaVersion to a higher version (e.g., 2020) or use a transpiler like Babel before Rollup to transform the code.
Run `npm install --save-dev rollup-plugin-ecma-version-validator`.
Change import to `import { ecmaVersionValidator } from 'rollup-plugin-ecma-version-validator'`.