An Interest In:
Web News this Week
- April 20, 2024
- April 19, 2024
- April 18, 2024
- April 17, 2024
- April 16, 2024
- April 15, 2024
- April 14, 2024
August 22, 2021 09:11 am GMT
Original Link: https://dev.to/juniortour/use-babel-to-parse-vue-js-sfc-coe
Use Babel to parse Vue.js SFC
Github Repo: vue-template-babel-compiler
Enable Optional Chaining(?.)
, Nullish Coalescing(??)
and many new ES syntax for Vue.js SFC based on Babel.
DEMO
Features
- All features of vue-template-compiler && vue-template-es2015-compiler
- new ES syntax:
Optional Chaining
,Bigint
,Nullish Coalescing
and more - Customization syntax, babel plugin...
Usage
1. Install
npm install vue-template-babel-compiler --save-dev
2. Config
1. Vue-CLI
// vue.config.jsmodule.exports = { chainWebpack: config => { config.module .rule('vue') .use('vue-loader') .tap(options => { options.compiler = require('vue-template-babel-compiler') return options }) }}
2. Nuxt.js
// nuxt.config.jsexport default { // Build Configuration: https://go.nuxtjs.dev/config-build build: { loaders: { vue: { compiler: require('vue-template-babel-compiler') } }, }, // ...}
3. Webpack
// your webpack.config.js where config vue-loadermodule.exports = { // ... module: { rules: [ { test: /\.vue$/, loader: 'vue-loader', options: { compiler: require('vue-template-babel-compiler') } } ] }}
API
Welcome for Issues && PR.
Original Link: https://dev.to/juniortour/use-babel-to-parse-vue-js-sfc-coe
Share this article:
Tweet
View Full Article
Dev To
An online community for sharing and discovering great ideas, having debates, and making friendsMore About this Source Visit Dev To