Giter VIP home page Giter VIP logo

Comments (8)

natemoo-re avatar natemoo-re commented on April 28, 2024 1

Yep, I'm good with this change.

I'm not sure if the built-in Skypack CDN behavior will work with Microsite's SSR setup... might be better to just support local builds for now.

from microsite.

eyelidlessness avatar eyelidlessness commented on April 28, 2024 1

I’ve thought about ways it could work (also tying in with #99), but after so many boondoggles around tests I’m definitely happy to keep it as small and focused as possible for a first start. I doubt I’ll look at it tomorrow, I’m going to yeet myself out to space if I don’t have a meaningful commit on my own site tomorrow. But I’ll be back to this, I definitely want it.

from microsite.

eyelidlessness avatar eyelidlessness commented on April 28, 2024 1

One more note on this because it’s something I’m tracking on my site: I tried a bunch of stuff locally with the contexts used to gather head/hydration to preload as much as possible and it seems Skypack itself is a bottleneck here. Going local already felt like a good direction given cache partitioning, but to add more flavor here, the Skypack CDN has a pretty much fixed 200-300ms latency and their cache headers don’t do well with even non-force reloads.

from microsite.

natemoo-re avatar natemoo-re commented on April 28, 2024

@eyelidlessness Makes sense. I'm taking a look at this now and I'll see where I get.

from microsite.

natemoo-re avatar natemoo-re commented on April 28, 2024

OK, you warned me but this was much more involved than I expected. 😅

What the build script does right now is mark preact as external for the SSG pass, which allows node to resolve preact to the same instance that microsite is using from node_modules. As a final pass Microsite transforms any references to bare preact in the generated dist files to point at the CDN. This works smoothly because we're only dealing with a single instance of preact, whereas if we include preact in the bundle, we're dealing with a version local to the user's components and a version local to Microsite's wrapper components. Due to Preact's architecture, despite both instances being the same exact version of Preact, they can't be mixed.

There's definitely a way around this, but I think it requires some more thought. I have a feeling v1.2.0 is going to be focused on eliminating the differences between the dev/build scripts, so this should fit nicely into that set of refactoring.

from microsite.

eyelidlessness avatar eyelidlessness commented on April 28, 2024

I’m still in early caffeination stage but this feels like it might be an easy solve by making Preact a dev/peer dependency? That way for users there should only be one version and no mixing

from microsite.

natemoo-re avatar natemoo-re commented on April 28, 2024

Unfortunately not, Snowpack bundles Preact into <STAGING_DIR>/_snowpack/pkg/preact.js, so userland components all pull that Preact instance while the Microsite SSG pass pulls from node_modules. It shouldn't be too hard to solve, just want to prioritize getting v1.1.0 out the door finally.

from microsite.

natemoo-re avatar natemoo-re commented on April 28, 2024

Just cross-referencing the fact that in #125, I promised Preact on Skypack would opt-in behavior in v1.2.0.

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

from microsite.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.