1.0.2 • Published 2 years ago

@nkduy/plugin-kdu-jsx v1.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

@nkduy/plugin-kdu-jsx

Provides Kdu 3 JSX & TSX support with HMR.

// vite.config.js
import kduJsx from '@nkduy/plugin-kdu-jsx'

export default {
  plugins: [
    kduJsx({
      // options
    })
  ]
}

HMR Detection

This plugin supports HMR of Kdu JSX components. The detection requirements are:

  • The component must be exported.
  • The component must be declared by calling defineComponent via a root-level statement, either variable declaration or export declaration.

Supported patterns

import { defineComponent } from 'kdu'

// named exports w/ variable declaration: ok
export const Foo = defineComponent(...)

// named exports referencing variable declaration: ok
const Bar = defineComponent(...)
export { Bar }

// default export call: ok
export default defineComponent(...)

// default export referencing variable declaration: ok
const Baz = defineComponent(...)
export default Baz

Non-supported patterns

// not using `defineComponent` call
export const Bar = { ... }

// not exported
const Foo = defineComponent(...)