handleExports = (originalExports, compilation, assets, assetsInfo) => {
    /** @type {Locals | undefined} */
    let locals;
    let namedExport;

    const esModule =
      typeof options.esModule !== "undefined" ? options.esModule : true;

    /**
     * @param {Dependency[] | [null, object][]} dependencies
     */
    const addDependencies = (dependencies) => {
      if (!Array.isArray(dependencies) && dependencies != null) {
        throw new Error(
          `Exported value was not extracted as an array: ${JSON.stringify(
            dependencies
          )}`
        );
      }

      const identifierCountMap = new Map();
      let lastDep;

      for (const dependency of dependencies) {
        if (!(/** @type {Dependency} */ (dependency).identifier) || !emit) {
          // eslint-disable-next-line no-continue
          continue;
        }

        const count =
          identifierCountMap.get(
            /** @type {Dependency} */ (dependency).identifier
          ) || 0;
        const CssDependency = MiniCssExtractPlugin.getCssDependency(webpack);

        /** @type {NormalModule} */
        (this._module).addDependency(
          (lastDep = new CssDependency(
            /** @type {Dependency} */
            (dependency),
            /** @type {Dependency} */
            (dependency).context,
            count
          ))
        );
        identifierCountMap.set(
          /** @type {Dependency} */
          (dependency).identifier,
          count + 1
        );
      }

      if (lastDep && assets) {
        lastDep.assets = assets;
        lastDep.assetsInfo = assetsInfo;
      }
    };

    try {
      // eslint-disable-next-line no-underscore-dangle
      const exports = originalExports.__esModule
        ? originalExports.default
        : originalExports;

      namedExport =
        // eslint-disable-next-line no-underscore-dangle
        originalExports.__esModule &&
        (!originalExports.default || !("locals" in originalExports.default));

      if (namedExport) {
        Object.keys(originalExports).forEach((key) => {
          if (key !== "default") {
            if (!locals) {
              locals = {};
            }

            /** @type {Locals} */ (locals)[key] = originalExports[key];
          }
        });
      } else {
        locals = exports && exports.locals;
      }

      /** @type {Dependency[] | [null, object][]} */
      let dependencies;

      if (!Array.isArray(exports)) {
        dependencies = [[null, exports]];
      } else {
        dependencies = exports.map(
          ([id, content, media, sourceMap, supports, layer]) => {
            let identifier = id;
            let context;

            if (compilation) {
              const module =
                /** @type {Module} */
                (findModuleById(compilation, id));

              identifier = module.identifier();
              ({ context } = module);
            } else {
              // TODO check if this context is used somewhere
              context = this.rootContext;
            }

            return {
              identifier,
              context,
              content: Buffer.from(content),
              media,
              supports,
              layer,
              sourceMap: sourceMap
                ? Buffer.from(JSON.stringify(sourceMap))
                : // eslint-disable-next-line no-undefined
                  undefined,
            };
          }
        );
      }

      addDependencies(dependencies);
    } catch (e) {
      callback(/** @type {Error} */ (e));

      return;
    }

    const result = (function makeResult() {
      const defaultExport =
        typeof options.defaultExport !== "undefined"
          ? options.defaultExport
          : false;

      if (locals) {
        if (namedExport) {
          const identifiers = Array.from(
            (function* generateIdentifiers() {
              let identifierId = 0;

              for (const key of Object.keys(locals)) {
                identifierId += 1;

                yield [`_${identifierId.toString(16)}`, key];
              }
            })()
          );

          const localsString = identifiers
            .map(
              ([id, key]) =>
                `\nvar ${id} = ${stringifyLocal(
                  /** @type {Locals} */ (locals)[key]
                )};`
            )
            .join("");
          const exportsString = `export { ${identifiers
            .map(([id, key]) => `${id} as ${JSON.stringify(key)}`)
            .join(", ")} }`;

          return defaultExport
            ? `${localsString}\n${exportsString}\nexport default { ${identifiers
                .map(([id, key]) => `${JSON.stringify(key)}: ${id}`)
                .join(", ")} }\n`
            : `${localsString}\n${exportsString}\n`;
        }

        return `\n${
          esModule ? "export default" : "module.exports = "
        } ${JSON.stringify(locals)};`;
      } else if (esModule) {
        return defaultExport
          ? "\nexport {};export default {};"
          : "\nexport {};";
      }
      return "";
    })();

    let resultSource = `// extracted by ${MiniCssExtractPlugin.pluginName}`;

    // only attempt hotreloading if the css is actually used for something other than hash values
    resultSource +=
      this.hot && emit
        ? hotLoader(result, { loaderContext: this, options, locals })
        : result;

    callback(null, resultSource);
  }
@param {TODO} originalExports
@param {Compilation} [compilation]
@param {{ [name: string]: Source }} [assets]
@param {Map<string, AssetInfo>} [assetsInfo]
@returns {void}