esbuild and Babel
GHNewbiee opened this issue · comments
Both esbuild and Babel can transform TypeScript, JSX, or newer ECMAScript features. Ok, esbuild can also do bundling (not included in the project) and minifying (included in the project).
If someone decides to install and work with Babel, what is the reason of existence of esbuild? Can it then be uninstalled?
Unfortunately, esbuild comes with Reboost, so it can't be uninstalled
At first sight (quick search), I found that esbuild
is mentioned only in the following files:
- .../node_modules/reboost/dist/node/plugins/index.js
- .../node_modules/reboost/dist/node/plugins/removed.js
- .../node_modules/reboost/dist/node/index.js
It also seems that its isolation is quite easy. So, if someone decides to use other transformation tool, then (s)he can easily "remove" the references and uninstall it. Am I correct or missing something?
Yes they can uninstall it, but they have to add this object to their plugins array
const { start, builtInPlugins: { esbuildPlugin } } = require('reboost');
start({
plugins: [
{ name: esbuildPlugin().name }
// Other plugins
]
})
This is necessary because Reboost adds esbuildPlugin
if it's not included by the user, by adding that object you tell Reboost that you have added esbuildPlugin
, but you are not actually adding any plugin functionality.
That's perfect! Or they can make the following changes: (I have the sense that I miss something...)
- .../node_modules/reboost/dist/node/index.js
...
- const esbuild_1 = require("./plugins/esbuild");
...
- if (!pluginNames.includes(esbuild_1.PluginName)) {
- plugins.push(esbuild_1.esbuildPlugin());
- }
- .../node_modules/reboost/dist/node/plugins/removed.js
...
- exports.esbuildPlugin = () => movedToBuiltIn('esbuildPlugin');
+ exports.esbuildPlugin = () => movedToDifferentPackage('esbuildPlugin', 'esbuild');
...
and
- .../node_modules/reboost/dist/node/plugins/index.js
...
- var esbuild_1 = require("./esbuild");
- Object.defineProperty(exports, "esbuildPlugin", { enumerable: true, get: function () { return esbuild_1.esbuildPlugin; } });
...
But, they have to apply the changes each time a new version of Reboost
comes out, haven't they?
You are correct and they have to apply the changes everytime reboost comes out.