https://github.com/vuejs/babel-preset-vue
Babel preset for transforming Vue JSX.
https://github.com/vuejs/babel-preset-vue
Last synced: 3 months ago
JSON representation
Babel preset for transforming Vue JSX.
- Host: GitHub
- URL: https://github.com/vuejs/babel-preset-vue
- Owner: vuejs
- License: mit
- Created: 2016-11-07T07:45:57.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2021-08-10T22:50:29.000Z (over 3 years ago)
- Last Synced: 2024-10-29T17:06:22.310Z (6 months ago)
- Language: JavaScript
- Homepage:
- Size: 240 KB
- Stars: 88
- Watchers: 29
- Forks: 11
- Open Issues: 9
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# babel-preset-vue
Babel preset for all Vue plugins.
## Install
```bash
npm install -D babel-preset-vue
```CDN: [UNPKG](https://unpkg.com/babel-preset-vue/)
## Usage
In your `.babelrc`:
```json
{
"presets": ["vue"]
}
```You can toggle specific features, by default all features are enabled, e.g.:
```json
{
"presets": [
["vue", {
"eventModifiers": false
}]
]
}
```## JSX Features
> Note that following features are not available for babel v7 currently, you may disable them if necessary.
### Event modifiers
Option name: `eventModifiers`
Uses [`babel-plugin-jsx-event-modifier`](https://github.com/nickmessing/babel-plugin-jsx-event-modifiers) for adding event modifiers support.
Example:
```js
Vue.component('hello-world', {
methods: {
method () {
console.log('clicked')
}
},
render () {
return (
)
}
})
```### v-model
Options name: `vModel`
Uses [`babel-plugin-jsx-v-model`](https://github.com/nickmessing/babel-plugin-jsx-v-model) for adding `v-model` support.
Example:
```js
Vue.component('hello-world', {
data: () => ({
text: 'Hello World!'
}),
render () {
return (
{this.text}
)
}
})
```## License
MIT © [EGOIST](https://github.com/egoist)