source: frontend/node_modules/workbox-webpack-plugin/src/lib/relative-to-output-path.ts

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: 925 bytes
RevLine 
[9af201e]1/*
2 Copyright 2018 Google LLC
3
4 Use of this source code is governed by an MIT-style
5 license that can be found in the LICENSE file or at
6 https://opensource.org/licenses/MIT.
7*/
8
9import upath from 'upath';
10import type {Compilation} from 'webpack';
11
12/**
13 * @param {Object} compilation The webpack compilation.
14 * @param {string} swDest The original swDest value.
15 *
16 * @return {string} If swDest was not absolute, the returns swDest as-is.
17 * Otherwise, returns swDest relative to the compilation's output path.
18 *
19 * @private
20 */
21export function relativeToOutputPath(compilation: Compilation, swDest: string): string {
22 // See https://github.com/jantimon/html-webpack-plugin/pull/266/files#diff-168726dbe96b3ce427e7fedce31bb0bcR38
23 if (upath.resolve(swDest) === upath.normalize(swDest)) {
24 return upath.relative(compilation.options.output.path!, swDest);
25 }
26
27 // Otherwise, return swDest as-is.
28 return swDest;
29}
Note: See TracBrowser for help on using the repository browser.