Created
February 17, 2018 15:43
-
-
Save wietseva/ce824e3b09504131055e76a550e918ea to your computer and use it in GitHub Desktop.
Revisions
-
wietseva created this gist
Feb 17, 2018 .There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,32 @@ const fs = require('fs') const isObject = val => val && typeof val === 'object' let pluginOptions = null module.exports = (api, cb) => { // Look up pluginOptions from the vue.config.js file // only do this once when its not yet defined const vueConfig = api.resolve('vue.config.js') if (!pluginOptions && fs.existsSync(vueConfig)) { let projectOptions = require(vueConfig) if (isObject(projectOptions.pluginOptions)) { pluginOptions = projectOptions.pluginOptions } else { pluginOptions = {} } } api.extendPackage((pkg) => { // extend pluginOptions // with those already defined in the pkg if (isObject(pkg.vue) && isObject(pkg.vue.pluginOptions)) { Object.assign(pluginOptions, pkg.vue.pluginOptions) } pluginOptions = cb(pluginOptions) return { vue: { pluginOptions } } }) }