Skip to content
This repository has been archived by the owner on Dec 5, 2024. It is now read-only.

Commit

Permalink
fix: handle preexisting babel plugins function
Browse files Browse the repository at this point in the history
  • Loading branch information
danielroe committed Jun 19, 2020
1 parent 4ad7d37 commit c5c338f
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,13 @@ const compositionApiModule: Module<any> = function () {
this.options.build = this.options.build || {}
this.options.build.babel = this.options.build.babel || {}
this.options.build.babel.plugins = this.options.build.babel.plugins || []
this.options.build.babel.plugins.push(join(__dirname, 'babel'))
if (this.options.build.babel.plugins instanceof Function) {
console.warn(
'Unable to automatically add Babel plugin. Make sure your custom `build.babel.plugins` returns `nuxt-composition-api/babel`'
)
} else {
this.options.build.babel.plugins.push(join(__dirname, 'babel'))
}

this.options.build.transpile = this.options.build.transpile || []
this.options.build.transpile.push(/nuxt-composition-api/)
Expand Down

0 comments on commit c5c338f

Please sign in to comment.