Giter Club home page Giter Club logo

Comments (4)

roblg avatar roblg commented on May 23, 2024

I think I'm in favor of this proposal. It makes sense to me to let react-server users ship ES6/esnext directly to browsers that support it.

I haven't thought deeply about what would be required from the technical side, but it seems like we'll probably want to ship both pre-transpiled and non-transpiled code for at least a little while to give existing users a chance to migrate.

Also, I assume that as part of this proposal we'd be renaming all the files in react-server to .esm.js?
And looking further down the road, if we're shipping untranspiled code, we'll probably want some way of communicating what level of ES we support in that code, to make it easy for users to know what all the need to transpile it, if necessary?

from react-server.

drewpc avatar drewpc commented on May 23, 2024

@roblg My plan was to submit a PR that uses Rollup to generate a non-transpiled ESM bundle and a transpiled UMD bundle (same as what is currently being produced). No need to change any existing filenames to .esm.js...just the final bundle.

I was also planning to create an entry in the documentation on how to use the ESM bundle and that the implementer has to take ownership of transpiling any features as they see fit (i.e. recommend the Babel settings). I've been thinking through the question of "do we need to share what level of ES is supported in the code" in my personal projects and I think the answer, in general is "no, we don't." If I use ES6 in my project and React Server uses ES7, Babel will transform all of code to whatever the transform target is. If that target is ES5, then both ES6 and ES7 code is transpiled/polyfilled to ES5. If that target is ES6, then just the React Server ES7 code is transpiled. None of that is ever communicated by the React Server project though...just that fact that it must be transpiled by the end user...that's it.

from react-server.

drewpc avatar drewpc commented on May 23, 2024

I'm planning to work on this over the next 2 weeks, so I'll have a rough codebase to share soon.

from react-server.

roblg avatar roblg commented on May 23, 2024

If I use ES6 in my project and React Server uses ES7, Babel will transform all of code to whatever the transform target is.

In this scenario, I was imagining that React Server would tell the user via docs "We're using ES7, so transpile that however you want.", or "We're using ES7 + <this one random experimental feature that has a plugin >", as a sort of contract between us and them. It'd be super annoying if users had to figure out what they needed to transpile by trial and error.

I thin the rest makes sense to me. 👍

from react-server.

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.