Skip to content

Enable Optional Chaining(?.), Nullish Coalescing(??) and many new ES syntax for Vue.js SFC based on Babel

Notifications You must be signed in to change notification settings

JuniorTour/vue-template-babel-compiler

Repository files navigation

vue-template-babel-compiler · Maintenance PRs Welcome

Enable Optional Chaining(?.), Nullish Coalescing(??) and many new ES syntax for Vue.js SFC based on Babel.

Downloads Size Version LastCommit CIStatus

DEMO

Visit Online Playground →

DEMO

Features

Usage

1. Install

npm install vue-template-babel-compiler --save-dev

2. Config

Vue-CLI Online Example Project
// 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
      })
  }
}
Nuxt.js Online Example Project
// nuxt.config.js
export default {
  // Build Configuration: https://go.nuxtjs.dev/config-build
  build: {
    loaders: {
      vue: {
        compiler: require('vue-template-babel-compiler')
      }
    },
  },
  // ...
}

Welcome for Issues && PR, see CONTRIBUTING.md for detail.