Skip to content

vuejs/vue-jsx-vapor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

709a585 · Feb 20, 2024

History

46 Commits
Jan 14, 2024
Jan 14, 2024
Feb 20, 2024
Jan 7, 2024
Feb 20, 2024
Jan 7, 2024
Jan 22, 2024
Jan 7, 2024
Jan 10, 2024
Jan 27, 2024
Jan 7, 2024
Jan 22, 2024
Jan 19, 2024
Feb 20, 2024
Feb 8, 2024
Jan 28, 2024
Jan 14, 2024
Jan 13, 2024

Repository files navigation

unplugin-vue-jsx-vapor

NPM version

Convert JSX to Template for compiler-vapor.

Install

npm i unplugin-vue-jsx-vapor
Vite
// vite.config.ts
import VueJsxVapor from 'unplugin-vue-jsx-vapor/vite'
import { compile } from 'vue/vapor'
// or
// import { compile } from '@vue/compiler-dom'

export default defineConfig({
  plugins: [
    VueJsxVapor({
      compile
    }),
  ],
})

Example: playground/


Rollup
// rollup.config.js
import VueJsxVapor from 'unplugin-vue-jsx-vapor/rollup'
import { compile } from 'vue/vapor'
// or
// import { compile } from '@vue/compiler-dom'

export default {
  plugins: [
    VueJsxVapor({
      compile
    }),
  ],
}


Webpack
// webpack.config.js
module.exports = {
  /* ... */
  plugins: [
    require('unplugin-vue-jsx-vapor/webpack')({
      compile: require('vue/vapor')
      // or
      // compile: require('@vue/compiler-dom')
    }),
  ],
}


Nuxt
// nuxt.config.js
import { compile } from 'vue/vapor'
// or
// import { compile } from '@vue/compiler-dom'
export default defineNuxtConfig({
  modules: [
    [
      'unplugin-vue-jsx-vapor/nuxt',
      {
        compile
      },
    ],
  ],
})

This module works for both Nuxt 2 and Nuxt Vite


Vue CLI
// vue.config.js
module.exports = {
  configureWebpack: {
    plugins: [
      require('unplugin-vue-jsx-vapor/webpack')({
        compile: require('vue/vapor')
        // or
        // compile: require('@vue/compiler-dom')
      }),
    ],
  },
}


esbuild
// esbuild.config.js
import { build } from 'esbuild'
import VueJsxVapor from 'unplugin-vue-jsx-vapor/esbuild'
import { compile } from 'vue/vapor'
// or
// import { compile } from '@vue/compiler-dom'

build({
  plugins: [
    VueJsxVapor({
      compile
    })
  ],
})