babel-plugin-remove-vue-extend
Babel plugin for removing Vue.extend
from components.
Usage
Install:
npm install babel-plugin-remove-vue-extend
yarn add babel-plugin-remove-vue-extend
.babelrc:
{
"plugins": ["remove-vue-extend"]
}
Then if you have the following component:
import Vue from 'vue'
export default Vue.extend({
data() {
return { message: 'Hello!' }
}
})
It will be transformed into:
export default {
data() {
return { message: 'Hello!' }
}
}
If you are using some extended component and extend from it like:
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:
import Sub from './Sub.vue'
export default {
extends: Sub,
data() {
return { message: 'Hello!' }
}
}
License
MIT