vue-template-babel-compiler
Enable Optional Chaining(?.)
, Nullish Coalescing(??)
and many new ES syntax for Vue.js SFC based on Babel.
DEMO
Features
Usage
1. Install
npm install vue-template-babel-compiler --save-dev
2. Config
DEMO project for Vue-CLI
module.exports = {
chainWebpack: config => {
config.module
.rule('vue')
.use('vue-loader')
.tap(options => {
options.compiler = require('vue-template-babel-compiler')
return options
})
}
}
DEMO project for Nuxt.js
export default {
build: {
loaders: {
vue: {
compiler: require('vue-template-babel-compiler')
}
},
},
}
module.exports = {
module: {
rules: [
{
test: /\.vue$/,
loader: 'vue-loader',
options: {
compiler: require('vue-template-babel-compiler')
}
}
]
}
}
Welcome for Issues && PR.