New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use isModern checks to decide which arch assets to put in the app.man… #9776
Use isModern checks to decide which arch assets to put in the app.man… #9776
Conversation
…ifest, and add filter for web.browser.legacy in isDynamic check
In one early implementation of the modern/legacy system, we were adding |
Yes, I would strongly support this approach, since source maps are not necessary for offline (non-development) usage, and the App Cache has a low maximum size (~5MB). |
I was thinking the way to deal with Without changing that upstream, we could strip out the legacy prefix, if there is a way to detect that the items came from the Some legacy browsers do support AppCache (IE11 for example) but not async/await. Removing public assets (and legacy built assets - which should work now) from the app.manifest altogether would mean |
A legacy client can still request modern resources from the web server, so it should be fine to put modern asset URLs in the manifest exposed to legacy clients. When I said it would be safe to exclude legacy assets from the manifest, I didn't mean we shouldn't put any assets in the manifest for legacy clients. I think we should use the same (modern) asset URLs for both modern and legacy clients. |
…est (also skip stats.json)
Ah, okay that was my misunderstanding. I figured my challenge then was to find a way to determine which assets in I used inference: { path: 'app/bw-icon.svg',
where: 'client',
type: 'asset',
cacheable: false,
url: '/bw-icon.svg',
size: 4579,
hash: '1413cd9a7131f878ee4c6aa09596235758d7b329' } For assets from
|
I tested this on a few more apps I have laying around, including a blaze app, and it seems to work well in at least my local set. I also took a look upstream, to see if there is a better way to remove the prefixes from assets which come from the // Also allow a special second suffix that will *only* be postpended to the
// url, useful for query parameters.
setUrlToHash(fileAndUrlSuffix, urlSuffix) {
urlSuffix = urlSuffix || "";
this.url = this.urlPrefix + "/" +
this.hash() + fileAndUrlSuffix + urlSuffix;
this.cacheable = true;
this.targetPath = this.hash() + fileAndUrlSuffix;
} If there is some way to know that the file came from |
…efix at build time for assets
I found the place in |
I could use some help figuring out the failing unit tests. I assume that removing the prefix from |
@CaptainN Most of those failures are either known-flaky tests or timeouts, and the one that looks legitimate actually passes locally for me, so I've just triggered a rerun of the failing tests. 🤞 |
…ectures. Since legacy assets are no longer disambiguated from modern assets with a /__browser.legacy/ URL prefix (#9776), we need a principled way to handle collisions in the staticFiles registry.
We seem to have a slight problem (surfaced in #9846): legacy/Cordova CSS files are not assets, so their URLs still have the If we go back to adding a prefix to asset URLs (as I think we must), we still have the problem of making sure non-prefixed asset URLs get included in the Update: I was able to use the |
This is an alternate solution to the problems #9776 was intended to fix.
I think the assumption is that the css file will be served from the root of the site. Can we still ensure that the main css file is served from that location?
I think we cannot prefix /public/ assets at all because the links users will set to those assets (added manually to source) assume no prefix. My suggestion would be to try and maintain pathing and locations for all these types of assets.
|
Alternatively we will have to rewrite all the links a user adds to their sources and things like that using a Babel plugin or something |
@CaptainN I hear what you're saying, and I'm increasingly feeling like the If we want to remove the Here's a PR that attempts to remove legacy prefixes: #9849 |
This PR does two things:
isModern
from themeteor/modern-browsers
package to output content to the app.manifest based on the requesting browser.A couple of other notes/questions:
isDynamic
method, we are checking to make sure.map
files are dynamic to avoid putting them in the app.manifest - but should we just always avoid putting.map
files in the manifest?/public
directory is listed correctly inWebApp.clientPrograms['web.browser.legacy'].manifest
. Assets from that location contain the/__browser.legacy/
prefix, but those URLs don't resolve. Additionally, those/public/
URLs do not match the links in theNETWORK
section below, which uses a different method to populate its list. I imagine the fix for this is somewhere upstream of this package.