vue-template-es2015-compiler
A post-compiler for Vue 2 template render functions that adds ES2015+ syntax support and strips strict-mode-breaking with blocks.
Repository Health
Technical Analysis
vue-template-es2015-compiler is an internal build-time dependency used by vue-loader and vueify to process the raw render functions produced by vue-template-compiler. It runs a fork of Buble over the generated code to selectively support ES2015+ template expression syntax — including object rest/spread in v-bind and v-slot, and trailing function commas — while keeping the base template compiler itself small and dependency-free.
It also strips the with block that Vue’s render functions are wrapped in by default, producing strict-mode-compliant output. Because this transform only runs at build time, projects that need to support older browsers like IE11 get ES2015+ template syntax without paying any runtime cost, as long as they separately polyfill Object.assign (which Vue CLI does automatically).
What You Get
- Selective ES2015+ transpilation - Applies only the specific Buble transforms Vue templates need (object rest/spread, trailing commas), not a full ES2015-to-ES5 pipeline.
- with-block stripping - Removes the with statement Vue render functions use internally, producing strict-mode-compliant JavaScript.
- Object.assign-based spread support - Rewrites object rest/spread syntax (e.g. v-bind=”{ …a, …b }”) into Object.assign calls instead of requiring a spread runtime helper.
- Zero runtime footprint - Runs only at build time inside vue-loader/vueify, so the shipped bundle carries no extra transform code.
Common Use Cases
- Building Vue 2 SFCs with vue-loader - Webpack projects using vue-loader rely on this package transparently to compile .vue template blocks that use rest/spread or trailing commas.
- Browserify + vueify pipelines - Projects using vueify as their Vue integration get the same ES2015+ template syntax support without a webpack toolchain.
- Supporting IE11 with modern template syntax - Authors can write object spread in v-bind/v-slot and still ship IE11-compatible output, provided Object.assign is polyfilled.
- Maintaining a lightweight core template compiler - By pushing ES2015+ support into this separate post-compiler, vue-template-compiler itself stays small and doesn’t need to bundle Buble.
Under The Hood
Architecture
The entire public surface is a single exported transpile(code, opts) function in index.js that merges caller options over defaults (stripWith: true, modules: false, objectAssign: 'Object.assign') and hands the code to a pre-built buble.js bundle. That bundle is not committed as source — it’s produced by a buble git submodule (a Vue-maintained fork at yyx990803/buble) via the package’s own npm run build script, which builds the submodule and copies its UMD output into buble.js before publish. There is effectively no layering beyond this thin wrapper; the real transform logic lives entirely inside the vendored Buble fork.
Tech Stack
Plain CommonJS Node module with no runtime dependencies of its own — buble.js is bundled in rather than required from node_modules. Development tooling is limited to Jest for tests and vue/vue-template-compiler as devDependencies used to produce realistic render-function input in tests. There is no bundler, TypeScript, or linter configuration in the repository; the build script’s only job is regenerating buble.js from the submodule.
Code Quality
Tests in test.js are integration-style: they compile real Vue templates with vue-template-compiler, run the output through transpile, and mount the result with the vue package to assert on rendered DOM output, covering rest/spread in v-bind and v-slot, trailing function commas, and v-model. This gives reasonable confidence the transform behaves correctly for its target syntax, but there is no static typing, no linter configuration, and no CI workflow checked into the repository, so quality assurance relies entirely on maintainers running Jest locally before publish.
What Makes It Unique
Its value isn’t novel transpilation technology — Buble does the actual work — but the very deliberate narrowness of scope: it exposes only the handful of ES2015+ features Vue templates realistically need, plus a Vue-specific with-stripping transform, so that vue-template-compiler can stay minimal while build tools still get modern template syntax. It’s an internal plumbing package rather than a general-purpose transpiler, and has been effectively feature-complete and unmaintained since Vue 2’s template syntax stabilized.