The `babel-preset-vue-app` package provides a consolidated Babel preset specifically tailored for Vue.js applications. Currently at version 2.0.0, this preset simplifies Babel configuration by integrating `babel-preset-env` for efficient polyfilling and targeting various JavaScript environments, and `babel-plugin-transform-runtime` to avoid polluting the global scope with polyfills. It additionally includes support for transforming Vue JSX, ES features like object rest/spread properties, dynamic imports, and modern `async/await` syntax. This preset aims to offer an opinionated, ready-to-use configuration for Vue projects, often serving as a foundational element in build setups from older Vue CLI versions or custom configurations. Its release cadence is primarily driven by updates to its underlying Babel dependencies. A key differentiator is its comprehensive, single-package approach to common Vue Babel needs, contrasting with a manual assembly of individual Babel plugins and presets.
npm install babel-preset-vue-appVerified import paths — ran on the pinned version, not inferred.
Shows the minimal `.babelrc` configuration to enable the `babel-preset-vue-app`.
To enable global polyfilling for these features (which modifies prototypes), set `useBuiltIns: true` in the preset options and ensure `core-js` is installed and imported globally (e.g., `import 'core-js/stable';`). Alternatively, manually import specific `core-js` shims where needed.
It is recommended to explicitly configure the `targets` option within the preset to precisely match your application's supported browser matrix (e.g., `{ browsers: ['last 2 versions', 'not dead', '> 0.2%'] }`) to optimize bundle size and performance.For new Vue projects, consider using `@vue/babel-preset-app` (installed via Vue CLI) or a custom Babel configuration tailored to your specific needs, leveraging individual Babel plugins and `babel-preset-env` directly.
Set `useBuiltIns: true` in your preset options and add `import 'core-js/stable';` at the entry point of your application, or manually import specific `core-js` shims for the missing features (e.g., `import 'core-js/features/string/includes';`).
Ensure you are using a compatible Babel version. If the problem persists, use a traditional browser list for `targets` (e.g., `targets: { browsers: ['last 2 versions'] }`) or define separate `env` configurations for modules and non-modules.No dependency data recorded yet.