Comments (11)
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.
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.
I think babel is evil 😁
from esbuild.
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.
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.
@mreinstein did you have a look at https://swc-project.github.io/ ?
from esbuild.
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.
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.
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.
@marton78 this looks super cool! Is this usable today, or is it more experimental at this point?
from esbuild.
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)
- Build failing in Dockerfile but works on local Windows machine
- Broken automatic JSX transform HOT 7
- ERROR: Expected "*/" to terminate multi-line comment HOT 2
- Expected ";" but found "const" - typescript transformer HOT 2
- Option to disable injected comment of input path file HOT 2
- Additional directories to watch HOT 3
- esbuild does not fail with undefined functions HOT 5
- Segmentation fault when using with vite and sveltekit project HOT 1
- Glob imports must match exactly
- Pass argument to IIFE HOT 2
- Esbuild causing bundle breakage when applied twice to the same bundle
- Splitting results in `Dynamic require of "<filename>" is not supported` when targeting `chrome62`
- [Feature Request] Add built-in HTML loader HOT 1
- Imports from stdio entrypoint don't have a namespace set
- DCE is not removed when value is from a const in another module.
- Get metafile info from a `watch()` rebuild HOT 2
- removes the backslash "\" when minify option is false HOT 4
- [Sourcemap] Private properties don't get sourcemapped correctly HOT 3
- ENV Secrets accessible from js code in a React + Rails APP. HOT 7
- [Feature] Ability to save charts from Bundle Size Analyzer as svg files
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 esbuild.