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.
This commit is contained in:
Ben Newman
2018-04-29 10:06:02 -04:00
parent 7e5e5b9fa1
commit d6c8a96bda

View File

@@ -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 {