Socket
Socket
Sign inDemoInstall

@vue/babel-preset-jsx

Package Overview
Dependencies
85
Maintainers
3
Versions
16
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @vue/babel-preset-jsx

Babel preset for Vue JSX


Version published
Weekly downloads
896K
increased by4.23%
Maintainers
3
Install size
2.53 MB
Created
Weekly downloads
 

Readme

Source

@vue/babel-preset-jsx

Configurable preset for Vue JSX plugins.

Babel Compatibility Notes

  • This repo is only compatible with Babel 7.x, for 6.x please use vuejs/babel-plugin-transform-vue-jsx

Usage

Install the dependencies:

# for yarn:
yarn add @vue/babel-preset-jsx @vue/babel-helper-vue-jsx-merge-props
# for npm:
npm install @vue/babel-preset-jsx @vue/babel-helper-vue-jsx-merge-props --save

In your babel.config.js:

module.exports = {
  presets: ['@vue/babel-preset-jsx'],
}

You can toggle specific features, by default all features (except compositionAPI) are enabled, e.g.:

module.exports = {
  presets: [
    [
      '@vue/babel-preset-jsx',
      {
        vModel: false,
        compositionAPI: true,
      },
    ],
  ],
}

Options are:

  • compositionAPI - Enables @vue/babel-sugar-composition-api-inject-h and @vue/babel-sugar-composition-api-render-instance, support returning render function in setup.
    • The default value is false;
    • When set to 'auto' (or true), it will detect the Vue version in the project. If it's >= 2.7, it will import the composition utilities from vue, otherwise from @vue/composition-api;
    • When set to 'native' (or 'naruto'), it will always import the composition utilities from vue
    • When set to plugin, it will always import the composition utilities from @vue/composition-api, but it will redirect to 'vue' itself when the vue version is 2.7.x
    • When set to vue-demi, it will always import the composition utilities from vue-demi
    • When set to an object like { importSource: string; }, it will always import the composition utilities from the importSource you set
  • functional @vue/babel-sugar-functional-vue - Functional components syntactic sugar
  • injectH @vue/babel-sugar-inject-h - Automatic h injection syntactic sugar
  • vModel @vue/babel-sugar-v-model - vModel syntactic sugar
  • vOn @vue/babel-sugar-v-on - vOn syntactic sugar

FAQs

Last updated on 25 Aug 2022

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc