Skip to content

How to use TSX component in vuepress-vite? #264

Answered by SituC
SituC asked this question in Q&A
Discussion options

You must be logged in to vote

I have found the answer to this question.
We can use configuration like this in config.ts.

import { defineUserConfig } from 'vuepress-vite'
import type { DefaultThemeOptions, ViteBundlerOptions } from 'vuepress-vite'

export default defineUserConfig<DefaultThemeOptions, ViteBundlerOptions>({
  bundler: '@vuepress/vite',
  bundlerConfig: {
    // vite options
    viteOptions: {
      // tsx support
      esbuild: {
        jsxFactory: 'h',
        jsxFragment: 'Fragment',
        jsxInject: "import { h } from 'vue'"
      },
    }
  },
})

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by SituC
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant