Comments (7)
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.
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.
Then remove the useState
?
from microbundle.
@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.
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.
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.
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)
- Using for of loop adds ~300 bytes of polyfill code HOT 5
- CSS var default `transparent` becomes `#0000` (Version 0.15.1) HOT 4
- Environment variables HOT 3
- Facing difficulty in using my bundled package HOT 2
- inline of dependency leads to failed imports in source HOT 14
- No name was provided for external module 'preact/compat' HOT 2
- Alias are specific only? HOT 2
- Wrong "import" in UMD bundle of UMD package HOT 8
- 打包后的产物 x.moduel.mjs 存在箭头函数,导致IE 无法兼容 HOT 3
- Add `x_google_ignoreList` (Ignore-listing code) support to sourcemaps HOT 9
- update rollup from 2.35.1 (2020-12-14) to at least 3.16.0 (2023-02-17), or ideally latest (4.6.1, 2023-11-30) HOT 12
- Cannot build when importing @sentry/browser HOT 5
- Dymanic imports not working in next.js and webpack applications HOT 2
- [typing import error][help wanted] The {{ package-name }} library may need to update its package.json or typings. HOT 8
- How can I include SVGs into my build? HOT 16
- Using React 17 or 18 i get the following error rpt2: options error TS5089: Option 'jsxFactory' cannot be specified when option 'jsx' is 'react-jsx'. HOT 1
- prevent export merge HOT 5
- Microbundle is awesome!
- Error when using file JS built by microbundle "Uncaught ReferenceError: require is not defined" HOT 17
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 microbundle.