urlToRelativePath_(url, base) {
    const to = new URL(url);
    const from = new URL(base);

    if (to.origin !== from.origin) {
      return url;
    }

    const toPath = to.pathname.split('/').slice(1);
    const fromPath = from.pathname.split('/').slice(1, -1);

    // remove common parents
    while (toPath[0] === fromPath[0]) {
      toPath.shift();
      fromPath.shift();
    }

    // add back paths
    while (fromPath.length) {
      fromPath.shift();
      toPath.unshift('..');
    }

    return toPath.join('/');
  }
Constructs a relative path from a URL

@param {string} url
@param {string} base
@return {string}
@private