Show HN: A simple website for my JavaScript bundler
fjbundler.com
fjbundler.com
And if you care about output size, you would also need to pass --define:process.env.NODE_ENV=\"production\" to esbuild since the benchmarks include React, and you don't want to bundle both the debug and release versions of React at the same time.
Good luck with your project!
> Most bundlers allows you to select an output format of the code, such as: "CommonJS", "AMD", "System", "UMD", "ES6", "ES2015" or "ESNext" FJB does not implement this concept. Instead, FJB adapts the code automatically through static analysis. FJB aims to generate code that works everywhere (when possible). A bundler should be smart enough so that the developer can focus on other things. :brain:
That sounds nice. In practice other tools that make similar promises end up being a big ball of incompatibility and config and plugins. I hope this won’t happen here!
> TypeScript support (currently unstable and under development)
IMO this is make or break for any tool I’d consider and I’ve had enough trouble with ESBuild and SWC which don’t even warn about incompatibilities that I’m wary.
I do know that I dislike things that try to support CommonJS or AMD or just dropping things into global variables, because I will only ever want it in one way, but it’s wasting a few hundred bytes of code supporting the others. But I am zealous for dead code removal to a degree that most aren’t.
1. Finds dead code and removes it 2. It converts nodejs code that isn't compatible with the browser into browser code 2. It converts JS code that isn't compatible with nodejs to nodejs code
It tries to always make things work both in nodejs and browser js.
One example is the optional chain syntax which doesn't work in nodejs but works in the browser. FJB converts it to something that works everywhere.
I’m not sure what that lot means. Are you talking about converting CommonJS to… I dunno, ECMAScript Modules? and vice versa? And there’s plenty that’s available in the NodeJS or web environments that’s simply unavailable in the other, e.g. the "http" and "https" modules from NodeJS and the fetch() global in the web, and you often can’t translate between the two at all, and even if you can, it’d be decidedly messy.
Output format is almost orthogonal to what I understand you to be talking about. In the terms of other bundling stuff, you seem to be talking more about features of Babel rather than features of webpack/Rollup, and if so, then output format is completely orthogonal.
We will see.
Anyhow, appreciate your feedback.
We're just in process of integrating ESBuild for stripping TypeScript types at work. I'd be interested to hear more about these incompatibilities you've encountered.
One thing to be aware of is that some other tools that integrate esbuild do so incorrectly. For example, the 3rd-party integration of esbuild into Webpack mis-configures esbuild in a way that causes issues with JSX: https://github.com/privatenumber/esbuild-loader/pull/107. This isn’t a problem with esbuild itself.
It all boils down to the need for complex builds to handle complex assets, and having to deal with the CommonJS format hell scape. (~90% of issues posted for Webpack and Rollup concern CommonJS format and Node-flavored module resolution) Once those two ecosystem concerns begin to be met, bundlers start getting in the user's way, because they have to.
ESBuild has legs, and may avoid a lot of the pitfalls, but only time will tell - it's very promising. None of this is to dissuade the author, or any potential users, from trying this new bundler out. However, over the last 8 years or so I've seen these kinds of promises many times. This is a situation in which the big players (Rollup, Webpack, et al) are complex where they are, because they have to be.
(cool to see your project on HN frontpage, Sebastian!)
Yes that docs page is actually auto generated from the github README, and it doesn't convert the links to anything appropriate