{"id":22000,"library":"rollup-plugin-ecma-version-validator","title":"rollup-plugin-ecma-version-validator","description":"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.","status":"active","version":"0.2.13","language":"javascript","source_language":"en","source_url":"https://github.com/koba04/rollup-plugin-ecma-version-validator","tags":["javascript","rollup","rollup-plugin","ecma","typescript"],"install":[{"cmd":"npm install rollup-plugin-ecma-version-validator","lang":"bash","label":"npm"},{"cmd":"yarn add rollup-plugin-ecma-version-validator","lang":"bash","label":"yarn"},{"cmd":"pnpm add rollup-plugin-ecma-version-validator","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"This is a Rollup plugin; it requires Rollup as a peer dependency.","package":"rollup","optional":false}],"imports":[{"note":"This package exports a named function, not a default export.","wrong":"import ecmaVersionValidator from 'rollup-plugin-ecma-version-validator'","symbol":"ecmaVersionValidator","correct":"import { ecmaVersionValidator } from 'rollup-plugin-ecma-version-validator'"},{"note":"This is a TypeScript type import, not a runtime value.","wrong":"import { EcmaVersionValidatorOptions } from 'rollup-plugin-ecma-version-validator'","symbol":"EcmaVersionValidatorOptions","correct":"import type { EcmaVersionValidatorOptions } from 'rollup-plugin-ecma-version-validator'"},{"note":"Do not use default require; the full export is an object.","wrong":"const ecmaVersionValidator = require('rollup-plugin-ecma-version-validator')","symbol":"plugin via require","correct":"const { ecmaVersionValidator } = require('rollup-plugin-ecma-version-validator')"}],"quickstart":{"code":"// rollup.config.js\nimport { ecmaVersionValidator } from 'rollup-plugin-ecma-version-validator';\n\nexport default {\n  input: 'src/index.js',\n  output: {\n    file: 'dist/bundle.js',\n    format: 'iife'\n  },\n  plugins: [\n    ecmaVersionValidator({\n      ecmaVersion: 5\n    })\n  ]\n};","lang":"typescript","description":"Basic usage of the plugin to validate that the bundle only contains ES5 syntax."},"warnings":[{"fix":"Ensure the plugin is included in the plugins array for the outputs you want to validate.","message":"The 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.","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"Set ecmaVersion to the target version you actually need, like 2020 for ES2020.","message":"The 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.","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"Remove acornOptions from the options object. Use ecmaVersion only.","message":"The option 'acornOptions' is no longer supported; Acorn parsing is internal. Custom Acorn options cannot be passed.","severity":"deprecated","affected_versions":">=0.2.0"},{"fix":"Upgrade to Rollup ^2.16.1 or ^3.x. If stuck on Rollup 1.x, stay on v0.1.x.","message":"v0.2.0 removed support for Rollup 1.x. Peer dependency changed to rollup ^2.16.1 || ^3.x.","severity":"breaking","affected_versions":">=0.2.0 <0.3.0"},{"fix":"Set ecmaVersion high enough to support dynamic imports (ES2020 or later) or disable validation for chunks that contain dynamic imports.","message":"The 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.","severity":"gotcha","affected_versions":">=0.1.0"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Either set ecmaVersion to a higher version (e.g., 2020) or use a transpiler like Babel before Rollup to transform the code.","cause":"The bundle contains syntax not valid for the target ECMAScript version. For example, arrow functions in an ES5 target.","error":"Error: [ECMA Version Validator] Unexpected token (1:5)"},{"fix":"Run `npm install --save-dev rollup-plugin-ecma-version-validator`.","cause":"The package is not installed or is missing from node_modules.","error":"Error: Cannot find module 'rollup-plugin-ecma-version-validator'"},{"fix":"Change import to `import { ecmaVersionValidator } from 'rollup-plugin-ecma-version-validator'`.","cause":"Default import was used instead of named import.","error":"TypeError: ecmaVersionValidator is not a function"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}