https://github.com/ktsn/babel-plugin-remove-vue-extend
Babel plugin for removing `Vue.extend` from components
https://github.com/ktsn/babel-plugin-remove-vue-extend
babel babel-plugin vue
Last synced: about 1 year ago
JSON representation
Babel plugin for removing `Vue.extend` from components
- Host: GitHub
- URL: https://github.com/ktsn/babel-plugin-remove-vue-extend
- Owner: ktsn
- License: mit
- Created: 2018-03-07T05:31:55.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2018-03-07T05:33:59.000Z (over 8 years ago)
- Last Synced: 2024-10-02T09:25:04.375Z (over 1 year ago)
- Topics: babel, babel-plugin, vue
- Language: TypeScript
- Size: 49.8 KB
- Stars: 7
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# babel-plugin-remove-vue-extend
Babel plugin for removing `Vue.extend` from components.
## Usage
Install:
```sh
npm install babel-plugin-remove-vue-extend
# or
yarn add babel-plugin-remove-vue-extend
```
.babelrc:
```json
{
"plugins": ["remove-vue-extend"]
}
```
Then if you have the following component:
```js
import Vue from 'vue'
export default Vue.extend({
data() {
return { message: 'Hello!' }
}
})
```
It will be transformed into:
```js
export default {
data() {
return { message: 'Hello!' }
}
}
```
If you are using some extended component and extend from it like:
```js
import Sub from './Sub.vue'
export default Sub.extend({
data() {
return { message: 'Hello!' }
}
})
```
It will be removed the `extend` call expression but moved into `extends` option:
```js
import Sub from './Sub.vue'
export default {
extends: Sub,
data() {
return { message: 'Hello!' }
}
}
```
## License
MIT