Coder Social home page Coder Social logo

Comments (7)

rschristian avatar rschristian commented on June 2, 2024

You can simply map "react-servers" to Microbundle's (existing) output, I don't think we should do anything different for arbitrary export conditions, personally.

Edit:

React Server Components seem to require independent source (e.g. useState is not allowed)

Not quite sure why you brought this up though, what do you expect Microbundle to do about this? Seems to be a user-code issue?

from microbundle.

tats-u avatar tats-u commented on June 2, 2024

Not quite sure why you brought this up though, what do you expect Microbundle to do about this? Seems to be a user-code issue?

The project I want to add the RSC support uses this project. It uses useState as of now.

from microbundle.

rschristian avatar rschristian commented on June 2, 2024

Then remove the useState?

from microbundle.

tats-u avatar tats-u commented on June 2, 2024

@rschristian It's bad. It does not render anything at first, but generates what should be rendered in useEffect and then rewrites the content. This is ideal in the client side.
And it's not my project.
As far as your response, this doesn't seem to be the use case you're envisioning.

from microbundle.

rschristian avatar rschristian commented on June 2, 2024

It's bad. It does not render anything at first, but generates what should be rendered in useEffect and then rewrites the content. This is ideal in the client side.

I don't follow -- what's bad?

Microbundle is intended to be a pretty generic bundler for tiny modules, it doesn't make much sense (IMO) to integrate a bunch of RSC-specific tooling. If RSCs don't support hooks, then that's something you need to handle on the input side or use a Babel plugin to strip out. Same goes for custom export conditions, you'll need to make sure your conditions match the files output by Microbundle as it won't take those paths into consideration itself.

I don't think there's anything actionable here for Microbundle. These are both items that should be addressed on the module's side of things.

from microbundle.

tats-u avatar tats-u commented on June 2, 2024

I don't follow -- what's bad?

From the client-side perspective, useEffect and useState are necessary, so we have to split the entrypoints.

Microbundle seems not to be for the project (that needs multiple entrypoints) now. Thanks.

from microbundle.

rschristian avatar rschristian commented on June 2, 2024

Indeed, but we're not the ones who wrote the RSC spec, not sure what you'd like us to do about it.

Again, a Babel plugin to strip out hooks could be another approach (then you'd just run Microbundle twice, once for the client component output and another time for the server) though I'm not sure if anyone's made that. Might be worth looking at other projects to see how they handle it.

I'll close this out as I don't think there's anything for us to address but if you do have any Microbundle-specific questions in the future feel free to ask.

from microbundle.

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.