About esbuild config
aoisummer opened this issue · 3 comments
aoisummer commented
Is there any options to config the target of esbuild? I want to compile code to es5 to be compatible with more browsers.
// ./src/assets/test.jsx
ReactDOM.render(
<div>Hello world</div>,
document.querySelector('#root')
);
// ./dist/assets/test.js
(() => { // <- Here is ES6 arrow function
// assets/test.jsx
ReactDOM.render(/* @__PURE__ */ React.createElement("div", null, "Hello world"), document.querySelector("#root"));
})();
sintaxi commented
Hmm, harp doesn't yet expose this yet but it makes sense to do so. Are you aware of how to configure esbuild?
aoisummer commented
Maybe I can understand the reason for doing that, but it's actually limit the browser support for this feature, by the way the follow code is an example:
require('esbuild').build({
entryPoints: ['src/test.jsx'],
bundle: true,
outfile: 'dist/test.js',
target: 'es5', // <- here
});
sintaxi commented
Thanks. I'll see what I can do.