Skip to content
This repository has been archived by the owner on May 11, 2018. It is now read-only.

Commit

Permalink
Only console.log the debug info once (#46)
Browse files Browse the repository at this point in the history
  • Loading branch information
hzoo authored Nov 16, 2016
1 parent dfb2755 commit d489c2e
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,8 @@ export const validateWhitelistOption = (whitelistOpt = []) => {
return whitelistOpt;
};

let hasBeenLogged = false;

export default function buildPreset(context, opts = {}) {
const loose = validateLooseOption(opts.loose);
const moduleType = validateModulesOption(opts.modules);
Expand All @@ -142,7 +144,10 @@ export default function buildPreset(context, opts = {}) {
let transformations = Object.keys(pluginList)
.filter((pluginName) => isPluginRequired(targets, pluginList[pluginName]));

if (debug) {
if (debug && !hasBeenLogged) {
hasBeenLogged = true;

console.log("babel-preset-env: `DEBUG` option");
console.log("");
console.log(`Using targets: ${JSON.stringify(targets, null, 2)}`);
console.log("");
Expand Down

0 comments on commit d489c2e

Please sign in to comment.