{"id":12599,"library":"vue-template-es2015-compiler","title":"Vue Template ES2015 Compiler","description":"This package is an internal build-time utility primarily used by `vue-loader` and `vueify` in Vue 2 projects. Its main function is to post-process raw render functions generated by `vue-template-compiler` to introduce support for ES2015+ features within template expressions, leveraging a custom fork of Buble. Additionally, it removes the `with` block from render functions to ensure strict-mode compliance. The current stable version is 1.9.1, but the package has not seen updates since February 2019, indicating it is no longer actively maintained for modern Vue development. It is a critical component for enabling advanced JavaScript syntax in Vue 2 templates during the build process, distinguishing itself by its specific focus on ES2015+ transpilation and strict-mode compatibility for Vue 2's compilation output.","status":"deprecated","version":"1.9.1","language":"javascript","source_language":"en","source_url":"https://github.com/vuejs/vue-template-es2015-compiler","tags":["javascript"],"install":[{"cmd":"npm install vue-template-es2015-compiler","lang":"bash","label":"npm"},{"cmd":"yarn add vue-template-es2015-compiler","lang":"bash","label":"yarn"},{"cmd":"pnpm add vue-template-es2015-compiler","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"This package typically exposes a default export for its primary compilation function. Direct import by end-users is uncommon as it's an internal tool.","wrong":"const { compile } = require('vue-template-es2015-compiler')","symbol":"compile","correct":"import compile from 'vue-template-es2015-compiler'"},{"note":"CommonJS `require` for its main function, likely named 'processRenderFunction' or similar in internal contexts. The package's `main` entry is `index.js`.","symbol":"processRenderFunction","correct":"const processRenderFunction = require('vue-template-es2015-compiler');"}],"quickstart":{"code":"const compile = require('vue-template-es2015-compiler');\n\n// Simulate a render function string from vue-template-compiler output\nconst rawRenderFn = `\n  with(this){\n    return _c('div', [\n      _v('Hello ' + (name)),\n      _c('button', { on: { click: () => ({ ...user, active: true }) } }, ['Click'])\n    ])\n  }\n`;\n\n// Options can be passed, though typically defaults are used by vue-loader\nconst options = {};\n\ntry {\n  const compiledResult = compile(rawRenderFn, options);\n  console.log('Processed Render Function:\\n', compiledResult);\n  // Expected output will have 'with' removed and ES2015+ features transpiled\n  // e.g., fat arrow functions, object spread to Object.assign\n} catch (error) {\n  console.error('Compilation Error:', error);\n}","lang":"javascript","description":"Demonstrates programmatic usage of the compiler to process a raw Vue render function string, transpiling ES2015+ features and removing `with` blocks."},"warnings":[{"fix":"For Vue 3 projects, use `@vue/compiler-sfc` or `@vue/cli-service` which integrates the correct compilers. If migrating from Vue 2, consult the Vue 3 migration guide.","message":"This package is exclusively for Vue 2 projects. It is superseded by `@vue/compiler-sfc` and `@vue/compiler-dom` in Vue 3 and should not be used in Vue 3 applications.","severity":"deprecated","affected_versions":">=1.0.0"},{"fix":"Ensure `Object.assign` is polyfilled for target browsers, especially IE. Modern Vue CLI setups typically handle this automatically.","message":"Since version 1.8.0, object rest spread usage within templates is transpiled to `Object.assign` calls. This requires a polyfill for `Object.assign` in older browsers, such as Internet Explorer, to prevent runtime errors.","severity":"breaking","affected_versions":">=1.8.0"},{"fix":"Rely on Vue CLI or `vue-loader` to integrate this compiler during the build process, rather than attempting direct usage in application code.","message":"This is an internal package primarily used by build tools like `vue-loader` and `vueify`. Direct programmatic usage by end-user applications is rare and generally not recommended, as its API is subject to change without public deprecation cycles.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"If encountering issues with modern tooling or language features, consider if your project can upgrade to Vue 3 where compilation is handled by actively maintained packages.","message":"The package has not been updated since February 2019 (version 1.9.1). This indicates a lack of ongoing maintenance, which may lead to compatibility issues with newer JavaScript features, tooling, or environments not present at the time of its last release.","severity":"gotcha","affected_versions":"<=1.9.1"}],"env_vars":null,"last_verified":"2026-04-19T00:00:00.000Z","next_check":"2026-07-18T00:00:00.000Z","problems":[{"fix":"Include a polyfill for `Object.assign` in your project's build process or runtime environment to support older browsers. Modern build setups often include `core-js` for this.","cause":"Attempting to use object rest/spread syntax in Vue 2 templates (transpiled by this compiler) in an environment (e.g., IE) that lacks native `Object.assign` support without a polyfill.","error":"Object.assign is not a function"},{"fix":"Ensure you are using the correct compiler for your Vue version. For Vue 3, this compiler is not used; `@vue/compiler-sfc` and `@vue/compiler-dom` are the standard. If in Vue 2, verify `vue-loader` and `vue-template-compiler` versions are compatible.","cause":"Using `vue-template-es2015-compiler` in a Vue 3 project, or misconfiguring Vue 2 components when relying on an outdated build chain. This compiler is Vue 2 specific.","error":"Unknown custom element: <YourComponent> - did you register the component correctly?"}],"ecosystem":"npm"}