Comments (10)
@Siilwyn I agree with that! Local will always be better for performance.
- v1.1.0 will remain on Skypack, purely because there are too many unrelated fixes/features that have needed to go out for a while.
- v1.2.0 will load Preact from a local
vendor
chunk by default. I can start on the architectural changes ASAP. Would love your help @eyelidlessness!
I'm about to push the pinned URL change and close this ticket. Followup can be handled in #106. As for the perf impact, switching to pinned URLs combined with link rel="modulepreload"
cuts the initial waterfall significantly—consistently under 100ms in my testing versus the current 400-600ms.
from microsite.
RE: the actual issue as reported, a big part of my motivation for #106 besides cache partitioning is that at least at present the Snowpack redirect causes a ~300ms waterfall on my connection, and their cache headers don’t help despite versioned URLs that could allow infinite caching for semver.
Probably something snowpack could improve both with headers and final resolution (hint to recent snowpack employees, subtle hint to recent snowpack employees who might be able to recruit if y’all want help improving the CDN)
from microsite.
Ah, I see what's happening here. Skypack has two different ways to reference a package, Lookup URLs ([email protected]
) and Pinned URLs (/pin/[email protected]
).
I don't think Preact is actually being fetched twice, but the Lookup URL introduces another network request and unnecessary latency. I'll switch over to using Pinned URLs.
from microsite.
Ah I see, didn't look at the actual payload...
Thought I would make a PR for this, seems like these links need to be changed:
Currently the Preact URL resolves to:
https://cdn.skypack.dev/pin/[email protected]/mode=imports,min/optimized/preact.js
However I think ideally this link would be generated in the build file, which does add complexity while I think going for a 'local' Preact version is a better solution. Shall I close this in favor of #106?
from microsite.
It shouldn't be too difficult to resolve the pinned url, there is an x-pinned-url
header on the Skypack response. I'm going to try to tackle this tonight since I already took a pass at #106 and it's unfortunately quite involved.
from microsite.
To clarify, I want to support both options! Resolving the pinned URL seems easier to land for v1.1.0
. #106 will probably be addressed in the next minor version.
from microsite.
I'm going to try to tackle this tonight since I already took a pass at #106 and it's unfortunately quite involved.
Once I come up for air on the final touches on the final launch task for my site (I’m aiming for tomorrow), this is something I’d like to try to work on with you if you’re interested. I know the internals pretty well but it’d help me make sense of where the various build events happen.
Also, it’s ambitious but I think tying this with #99 could help reduce the complexity on this one. I’ve already got two custom (future OSS) plugins that use the Snowpack optimize
step to operate on the built staging files in situ and this could potentially be a way around the multiple instances of Preact constraint. A general final-phase plugin that allows post processing the first build phase from the same state with the same logic Microsite used for its second phase would also be an API improvement.
from microsite.
Supporting both is fine, what are your thoughts on the default though? I really strongly think using the CDN should be opt-in behaviour.
from microsite.
That’s a major improvement!
from microsite.
Yes nice! 🥳
from microsite.
Related Issues (20)
- Remove defer from inline scripts HOT 3
- Move `microsite-templates` into this repo HOT 1
- Doesn't do the thing 🙃 HOT 3
- production build fails when CSS module is imported on multiple pages HOT 2
- getStaticProps + node builtins + dev server fails HOT 1
- Preact import regex matches too much HOT 2
- Preact CDN lookup fails for non-hardcoded submodules HOT 1
- Enhancement: Support SSR-able components as props for hydrated components HOT 7
- getStaticPaths uses module’s path when returning params object HOT 1
- [RFC] Built-in Markdown/MDX Support HOT 2
- Dynamic routes won't work in dev mode HOT 4
- Hydrated component isn't initialized in prod builds when it is exported/imported under a name different from the name of the component it decorates HOT 6
- Make withHydrate a no-op when nested rather than an error
- Hydration fails with nested props arrays/objects HOT 7
- Build fails with "Error: You must supply options.input to rollup"
- import.meta.env.SSR is true on the client HOT 1
- Preact modules are loaded with `modulepreload` even if they're not used
- dev server fails to load fetch HOT 1
- Add SCSS/SASS support?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from microsite.