babel-plugin-remove-vue-extend
TypeScript icon, indicating that this package has built-in type declarations

0.1.0 • Public • Published

babel-plugin-remove-vue-extend

Babel plugin for removing Vue.extend from components.

Usage

Install:

npm install babel-plugin-remove-vue-extend
# or 
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

Package Sidebar

Install

npm i babel-plugin-remove-vue-extend

Weekly Downloads

2

Version

0.1.0

License

MIT

Unpacked Size

5.77 kB

Total Files

5

Last publish

Collaborators

  • ktsn