Code Monkey home page Code Monkey logo

Comments (9)

theKashey avatar theKashey commented on June 1, 2024

Your code seems to be ok. Let me check what is wrong.

from react-imported-component.

theKashey avatar theKashey commented on June 1, 2024

Your example is perfectly working for me. Visually. Both for dev and SSR modes.

But - rehydrateMarks by fact does nothing - it could not found a mark to rehydrate, and not preloading async chunk before react hydrate (causing "blink")
Something like today I am going to publish a new minor version, which changes the SSR approach. It will fix everything for any bundler you may use(thats the goal).

from react-imported-component.

krazyjakee avatar krazyjakee commented on June 1, 2024

To clarify, I see the client render too, but in view-source://localhost:1234/codeSplit, I don't see the script/link tags for additional css/js and the html that makes up the page.

I'll wait for your change and try again with any new logic. Thanks so much for your reply!

from react-imported-component.

theKashey avatar theKashey commented on June 1, 2024

There will be no additional scripts on the page. "Translating" the imports into bundler specific files is a dead end.
React-imported-component repeats the imports you wrote in your code. From one point of view - it will delay loading by one "hop", requiring main bundle to be loaded in front, but from another - it will just work with parcel, not only with webpack, as usual.

from react-imported-component.

krazyjakee avatar krazyjakee commented on June 1, 2024

Is what I'm describing even possible? For SEO reasons the contents of a page (component) should be rendered by the server first. I noticed with react universal component I got as far as rendering the "Loading..." message but it did not render the component. Is this functionality unavailable in the ecosystem right now?

from react-imported-component.

theKashey avatar theKashey commented on June 1, 2024

All "SSR-Aware" loaders could do this. They will keep your pre-rendered content unchanged unless they will be fully prepared to replace(rehydrate) it.
But usually you have to kick loader into this waiting. Here this command names rehydrateMarks, and it is broken a bit for parcel.

from react-imported-component.

theKashey avatar theKashey commented on June 1, 2024

Ok, it lead to the major version change.
v4 just got published, and your example was used as example :)

Could confirm that everything works just perfect.

from react-imported-component.

krazyjakee avatar krazyjakee commented on June 1, 2024

Oh wow, such an honor thank you 💃 !

I will check this out tonight. I mean, this is something quite special really. SSR, code-split react with fast compilation and zero configuration... very cool.

from react-imported-component.

theKashey avatar theKashey commented on June 1, 2024

Not zero :)

from react-imported-component.

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.