How to use the ts-loader/dist/utils.js.formatErrors function in ts-loader

To help you get started, we’ve selected a few ts-loader examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github google / neuroglancer / config / ts_loader_patch.js View on Github external
tsLoaderConfigModule.getConfigFile = function getConfigFile(
    compiler, loader, loaderOptions, compilerCompatible, log, compilerDetailsLogMessage) {
  let configFilePath = loaderOptions.configFileName;
  var configFileError;
  log.logInfo(('ts-loader: Using config file at ' + configFilePath).green);
  let configFile = compiler.readConfigFile(configFilePath, compiler.sys.readFile);
  if (configFile.error) {
    configFileError = tsLoaderUtilsModule.formatErrors(
        [configFile.error], loaderOptions, compiler, {file: configFilePath})[0];
  }
  if (!configFileError) {
    configFile.config.compilerOptions =
        Object.assign({}, configFile.config.compilerOptions, loaderOptions.compilerOptions);
    // do any necessary config massaging
    if (loaderOptions.transpileOnly) {
      configFile.config.compilerOptions.isolatedModules = true;
    }
  }
  return {configFilePath: configFilePath, configFile: configFile, configFileError: configFileError};
};