Skip to content

scriptLang NPM Version

Stability: experimental ⚠️ Experimental feature, use at your risk

Set the default language for <script> block.

TIP

Convert <script setup> to <script setup lang="ts">.

FeaturesSupported
Vue 3
Nuxt 3
Vue 2
Volar Plugin

Options

ts
interface Options {
  /**
   * @default 'ts'
   */
  defaultLang?: 'ts' | 'tsx' | 'jsx' | string
}

Usage

vue
<script setup>
defineProps
<{
foo
: string
}>() </script>

Volar Configuration

tsconfig.json
jsonc
{
  "vueCompilerOptions": {
    "plugins": ["unplugin-vue-macros/volar"],
    "vueMacros": {
      "scriptLang": {
        "defaultLang": "ts",
      },
    },
  },
}

Contributors

Changelog