"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.configTPHashMappingPlugin = configTPHashMappingPlugin;

var _path = _interopRequireDefault(require("path"));

var _TPHashMappingPlugin = require("../custom_plugins/TPHashMappingPlugin");

var _modeUtils = require("../common/modeUtils");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function configTPHashMappingPlugin(options) {
  const {
    fileHashMappingToVariable,
    context,
    mode
  } = options;

  if ((0, _modeUtils.isProductionMode)(mode) && fileHashMappingToVariable) {
    return new _TPHashMappingPlugin.TPHashMappingPlugin({
      fileMappings: fileHashMappingToVariable,
      tpFolder: `${_path.default.join(process.cwd(), context)}`
    });
  }

  ;
  return null;
}