{"id":25920,"library":"maptalks-rollup-plugin-babel","title":"rollup-plugin-babel","description":"Rollup plugin for seamless integration with Babel. Version 3.0.2 is the latest stable release. It allows transpiling ES6/7 code with Babel while preserving Rollup's tree-shaking and module resolution, avoiding intermediate files and sourcemap issues. Unlike running Babel before Rollup, this plugin handles transpilation per-file, preventing Babel helper duplication. Requires babel-core 6 or 7 as a peer dependency. Key differentiator: integrates directly into Rollup's plugin system, supporting .babelrc configuration and options like include/exclude patterns. Deprecated in favor of @rollup/plugin-babel as of Rollup 1.0.","status":"deprecated","version":"3.0.2","language":"javascript","source_language":"en","source_url":"https://github.com/rollup/rollup-plugin-babel","tags":["javascript","rollup-plugin","babel","es2015","es6"],"install":[{"cmd":"npm install maptalks-rollup-plugin-babel","lang":"bash","label":"npm"},{"cmd":"yarn add maptalks-rollup-plugin-babel","lang":"bash","label":"yarn"},{"cmd":"pnpm add maptalks-rollup-plugin-babel","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency - required for Babel transpilation","package":"babel-core","optional":false}],"imports":[{"note":"Default export only; named export not available.","wrong":"import { babel } from 'rollup-plugin-babel'","symbol":"default","correct":"import babel from 'rollup-plugin-babel'"},{"note":"CommonJS require returns the default export directly.","wrong":"const { babel } = require('rollup-plugin-babel')","symbol":"default","correct":"const babel = require('rollup-plugin-babel')"},{"note":"No subpath exports; only default import from root.","wrong":"import babel from 'rollup-plugin-babel/default'","symbol":"default","correct":"import babel from 'rollup-plugin-babel'"}],"quickstart":{"code":"import { rollup } from 'rollup';\nimport babel from 'rollup-plugin-babel';\n\nrollup({\n  input: 'src/main.js',\n  plugins: [\n    babel({\n      exclude: 'node_modules/**',\n      babelrc: false,\n      presets: [['@babel/preset-env', { modules: false }]],\n      plugins: ['@babel/plugin-external-helpers']\n    })\n  ]\n}).then(bundle => {\n  bundle.write({ file: 'dist/bundle.js', format: 'cjs' });\n}).catch(err => console.error(err));","lang":"javascript","description":"Shows basic Rollup config with Babel plugin, excluding node_modules and disabling module transformation."},"warnings":[{"fix":"Replace with @rollup/plugin-babel: npm install @rollup/plugin-babel --save-dev and update import to require('@rollup/plugin-babel')","message":"rollup-plugin-babel is deprecated; use @rollup/plugin-babel instead.","severity":"deprecated","affected_versions":">=3.0.0"},{"fix":"Downgrade to version 1: npm install rollup-plugin-babel@1 --save-dev or upgrade to Babel 6+.","message":"Version 2 drops support for Babel 5. Use rollup-plugin-babel@1 if still on Babel 5.","severity":"breaking","affected_versions":">=2.0.0"},{"fix":"Ensure babel-core (not @babel/core) is installed: npm install babel-core@^7.0.0 --save-dev","message":"Requires babel-core 6 or 7 as peer dependency. Installing without matching Babel version will cause runtime errors.","severity":"breaking","affected_versions":">=3.0.0"},{"fix":"In .babelrc or plugin options: set modules: false in preset config, e.g., [\"@babel/preset-env\", { \"modules\": false }]","message":"Babel presets that include module transformation (e.g., es2015 with modules) break Rollup. Must set modules: false.","severity":"gotcha","affected_versions":">=2.0.0"},{"fix":"Add @babel/plugin-external-helpers to Babel plugins and set externalHelpers: true in rollup-plugin-babel options.","message":"Using external-helpers plugin is recommended to avoid Babel helper duplication in the bundle.","severity":"gotcha","affected_versions":">=2.0.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Install compatible babel-core: npm install babel-core@^7.0.0-bridge","cause":"Mismatch between required babel-core version and installed version.","error":"Error: Requires Babel \"7\", but was loaded with \"6.26.3\""},{"fix":"Add '/node_modules/' to exclude or configure Babel correctly: set modules: false in presets.","cause":"Babel did not transpile the file (e.g., included in node_modules) or modules: false not set.","error":"Module parse failed: Unexpected token on import statement"},{"fix":"Ensure Babel plugins are in array format: [\"plugin-name\", options] or just \"plugin-name\".","cause":"Using a non-array plugin format in .babelrc.","error":"Error: Plugin 0 specified in \"base\" provided an invalid property of type \"function\""}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}