source: frontend/node_modules/webpack-dev-middleware/dist/utils/getPaths.js

Last change on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 12 days ago

Fix frontend appearance

  • Property mode set to 100644
File size: 1.2 KB
RevLine 
[9af201e]1"use strict";
2
3/** @typedef {import("webpack").Compiler} Compiler */
4
5/** @typedef {import("webpack").Stats} Stats */
6
7/** @typedef {import("webpack").MultiStats} MultiStats */
8
9/** @typedef {import("../index.js").IncomingMessage} IncomingMessage */
10
11/** @typedef {import("../index.js").ServerResponse} ServerResponse */
12
13/**
14 * @template {IncomingMessage} Request
15 * @template {ServerResponse} Response
16 * @param {import("../index.js").Context<Request, Response>} context
17 */
18function getPaths(context) {
19 const {
20 stats,
21 options
22 } = context;
23 /** @type {Stats[]} */
24
25 const childStats =
26 /** @type {MultiStats} */
27 stats.stats ?
28 /** @type {MultiStats} */
29 stats.stats : [
30 /** @type {Stats} */
31 stats];
32 const publicPaths = [];
33
34 for (const {
35 compilation
36 } of childStats) {
37 // The `output.path` is always present and always absolute
38 const outputPath = compilation.getPath(compilation.outputOptions.path || "");
39 const publicPath = options.publicPath ? compilation.getPath(options.publicPath) : compilation.outputOptions.publicPath ? compilation.getPath(compilation.outputOptions.publicPath) : "";
40 publicPaths.push({
41 outputPath,
42 publicPath
43 });
44 }
45
46 return publicPaths;
47}
48
49module.exports = getPaths;
Note: See TracBrowser for help on using the repository browser.