Webpack loader that pre-compiles Vue.js 2.0 HTML templates into render functions using vue-template-compiler. Current stable version is 1.1.0 (released June 2019) with low release cadence. Supports scoped CSS, CSS modules, HMR, and functional components. A lighter alternative to vue-loader when you only need template compilation. Note: requires vue-template-compiler as a peer dependency and is specifically for Vue 2 — incompatible with Vue 3.
npm install vue-template-loaderVerified import paths — ran on the pinned version, not inferred.
Shows basic webpack config, a Vue HTML template, and usage of the compiled render function to create a component.
Replace `transformToRequire` with `transformAssetUrls` in loader options.
Test your templates after upgrading. Ensure vue-template-compiler peer dependency matches Vue 2 version.
Use `import withRender from './template.html?style=./style.css'` and set `enforce: 'post'` on style loaders that should run after scope injection.
For Vue 3, migrate to vue-loader or use @vue/compiler-sfc directly.
Add `options: { functional: true }` to the loader rule for functional templates. Use `oneOf` for mixed setups.npm install vue-template-compiler --save-dev (ensure version matches your Vue version)
Use: const Component = withRender({ /* options */ });Add rule: { test: /\.html$/, use: 'vue-template-loader' } to your webpack config.Verify .html file is processed by vue-template-loader and import path is correct.