Skip to content

Commit

Permalink
feat: add an option to enable/disable plugin when in dev mode (#16)
Browse files Browse the repository at this point in the history
  • Loading branch information
emaia committed Nov 1, 2020
1 parent eb2c9cd commit fb05c9f
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib/module.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,19 @@ module.exports = function facebookPixelModule (moduleOptions) {
pixelId: null,
track: 'PageView',
version: '2.0',
disabled: false
disabled: false,
debug: false
}

const options = Object.assign({}, defaults, this.options.facebook, moduleOptions)

if (!options.pixelId) throw new Error('The `pixelId` option is required.')

// Don't include when run in dev mode unless debug: true is configured
if (this.options.dev && !options.debug) {
return
}

this.addPlugin({
src: path.resolve(__dirname, './templates/plugin.js'),
ssr: false,
Expand Down

0 comments on commit fb05c9f

Please sign in to comment.