Giter VIP home page Giter VIP logo

Comments (11)

mreinstein avatar mreinstein commented on April 28, 2024 2

Babel isn't evil, it's just a very complicated tool. If it weren't for babel I wouldn't be able to do a lot of things at work that I'm currently able to do.

from esbuild.

ravener avatar ravener commented on April 28, 2024 1

If we get a way to register some plugins at build time we could integrate something like https://github.com/jvatic/goja-babel although it will be slower because it has to interpret JavaScript with Go.

from esbuild.

sarkiroka avatar sarkiroka commented on April 28, 2024 1

I think babel is evil 😁

from esbuild.

mreinstein avatar mreinstein commented on April 28, 2024 1

At my day job, I need to support ie11 and ie10. That's why babel is important in my workflow. If I want to use modern javascript features, it's really hard to avoid.

My build pipeline basically looks like this:

                     ┌---------------┐            ┌-----------------------┐ 
                     |               |            |                       | 
                     | bundle to es6 ├-----------▶| modern browsers use   | 
┌-------------┐      | (bundle.mjs)  |            | bundle.mjs            | 
|             ├-----▶|               |            |                       | 
| source code |      └---------------┘            └-----------------------┘ 
|             |                                                             
└---------┬---┘                                                             
          |          ┌------------------------┐   ┌------------------------┐
          |          |                        |   | ie browsers use        |
          |          | bundle to es5 (babel)  |   | bundle.js              |
          └---------▶| (bundle.js)            ├--▶|                        |
                     |                        |   |                        |
                     └------------------------┘   └------------------------┘

some day ie will become irrelevant, and I can drop the lower portion of this build pipeline.

from esbuild.

mreinstein avatar mreinstein commented on April 28, 2024 1

Sorry, I don't understand when is the moment that you can drop the dependency

The moment our business no longer needs to support internet explorer. (see the bottom 2 boxes in that diagram.) Today, when you visit our website, if you are not using ie, there is no babel that gets used, at any point in our build process.

Everybody say "I use just because I need to support IE" but this is a lie

Avoid generalizing large groups of people. The company I work for is only using babel for ie users. Our stuff runs on every major retailer website excluding Amazon (Walmart, Costco, BestBuy, Lowes, Target, CircuitCity, and a few hundred more.)
This isn't theoretical, it is how this code runs today. We're living the dream! :)

you cannot drop babel when not need to support IE.

You have a choice in the code you develop: you can choose to use new javascript features that aren't in browers yet, or you can stick to the subset of javascript that is supported "almost everywhere".

I'll give you an example; if you don't need internet explorer support, this code today doesn't need babel:

async function main () {
   let result = await fetch('https://foo.com')
}

main()

If however you start adding fancy new javascript features that aren't supported in browsers, then yes you'd need babel or some alternative compiler. the choice is up to you; use more conservative development techniques or transpile via babel. No one is forcing you to always use the newest beta javascript capabilities. It's your choice to make! Freedom! horrible horrible freedom! :)

from esbuild.

marton78 avatar marton78 commented on April 28, 2024 1

@mreinstein did you have a look at https://swc-project.github.io/ ?

from esbuild.

evanw avatar evanw commented on April 28, 2024 1

can you clone yourself and make a similar project for babel?

I'm not planning on expanding the scope of this project to include everything that Babel does. I'm also not planning to start another similar project to Babel myself.

can you envision a way that babel could be used with esbuild?

Good question. As others have said above, sometimes there is still legitimate need for running your JavaScript code in ancient browsers such as IE. In that case, I could see using Babel (or swc) as a post-process on the output of esbuild to create a special bundle meant just for older browsers.

from esbuild.

sarkiroka avatar sarkiroka commented on April 28, 2024

The browsers are slowly catching up and everyone will support everything. But we can't get rid of the babel, though most things would work without it. That's why I think it's evil. It is a great vendor lock on your code, and never drop out.
PS.: on my projects there is not need to support of IE11-, Chrome current-2, Firefox current-2, etc.

from esbuild.

sarkiroka avatar sarkiroka commented on April 28, 2024

Sorry, I don't understand when is the moment that you can drop the dependency. Everybody say "I use just because I need to support IE" but this is a lie. It is a lie because you cannot drop babel when not need to support IE. This is a strong vendor lock

from esbuild.

mreinstein avatar mreinstein commented on April 28, 2024

@marton78 this looks super cool! Is this usable today, or is it more experimental at this point?

from esbuild.

evanw avatar evanw commented on April 28, 2024

I'm going to close this because my answer above got a 👍, so it looks like I answered the original question.

from esbuild.

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.