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

Only console.log the debug info once #46

Merged
merged 2 commits into from
Nov 16, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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