"use strict";

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

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

var _constants = require("../../constants");

var _nameTemplates = require("./common/nameTemplates");

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

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

function outputConfig(options) {
  const {
    output,
    publicPath,
    htmlTemplate
  } = options;
  const outputO = {
    filename: (0, _nameTemplates.nameTemplates)('js', options),
    chunkFilename: (0, _nameTemplates.nameTemplates)('chunkjs', options),
    chunkLoadingGlobal: (0, _modeUtils.getGlobalCacheStorageName)(options),
    publicPath,
    // clean: true,
    path: _path.default.resolve(_constants.appPath, output)
  };

  if (htmlTemplate.crossorigin) {
    outputO.crossOriginLoading = 'anonymous';
  }

  return outputO;
}