From d6c8a96bdabf9212918e7f2233acfd6375e2cbb2 Mon Sep 17 00:00:00 2001 From: Ben Newman Date: Sun, 29 Apr 2018 10:06:02 -0400 Subject: [PATCH] Refine URL prefix logic to exclude just web.browser[.legacy]. This still leaves web.cordova as the only architecture whose URLs get prefixed (with /__cordova/), but the implementation better reflects the special status of web.browser and web.browser.legacy as architectures that the webapp and dynamic-import packages understand how to disambiguate using the isModern test from the modern-browsers package. --- tools/isobuild/bundler.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/tools/isobuild/bundler.js b/tools/isobuild/bundler.js index 08ca577c0b..6c2f72d1bd 100644 --- a/tools/isobuild/bundler.js +++ b/tools/isobuild/bundler.js @@ -567,8 +567,16 @@ class File { this.url = null; // A prefix that will be prepended to this.url. - // Prefixing is currently restricted to Cordova URLs. - if (options.arch === "web.cordova") { + // Prefixing is currently restricted to web.cordova URLs. + if (options.arch.startsWith("web.") && + // Using the isModern function from the modern-browsers package, + // the webapp and dynamic-import packages can automatically + // determine whether a client should receive resources from the + // web.browser or web.browser.legacy architecture, so those + // architectures do not need a URL prefix. Other architectures, + // such as web.cordova, still need a prefix like /__cordova/. + options.arch !== "web.browser" && + options.arch !== "web.browser.legacy") { this.urlPrefix = "/__" + options.arch.split(".").slice(1).join("."); } else {