Post compiler for Vue template render functions to support ES features with Babel
npm install vue-template-babel-compilerEnable Optional Chaining(?.), Nullish Coalescing(??) and many new ES syntax for Vue.js SFC based on Babel.
src="https://img.shields.io/npm/dt/vue-template-babel-compiler"
alt="Downloads">
src="https://img.shields.io/github/size/JuniorTour/vue-template-babel-compiler/lib/index.js"
alt="Size">
src="https://img.shields.io/npm/v/vue-template-babel-compiler.svg?sanitize=true"
alt="Version">
src="https://img.shields.io/github/last-commit/JuniorTour/vue-template-babel-compiler?sanitize=true"
alt="LastCommit">
src="https://github.com/JuniorTour/vue-template-babel-compiler/actions/workflows/main.yml/badge.svg"
alt="CIStatus">
!DEMO
Optional Chaining, Bigint, Nullish Coalescing and more bash
npm install vue-template-babel-compiler --save-dev
`$3
#### 1. Vue-CLI` js
// vue.config.js
module.exports = {
chainWebpack: config => {
config.module
.rule('vue')
.use('vue-loader')
.tap(options => {
options.compiler = require('vue-template-babel-compiler')
return options
})
}
}
`#### 2. Nuxt.js
` js
// nuxt.config.js
export default {
// Build Configuration: https://go.nuxtjs.dev/config-build
build: {
loaders: {
vue: {
compiler: require('vue-template-babel-compiler')
}
},
},
// ...
}
`Doc
- vue-jest Usage
- Webpack Usage
- VueUse &&