Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

About esbuild config #667

Open
aoisummer opened this issue Jul 18, 2021 · 3 comments
Open

About esbuild config #667

aoisummer opened this issue Jul 18, 2021 · 3 comments

Comments

@aoisummer
Copy link

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
Copy link
Owner

sintaxi commented Jul 18, 2021

Hmm, harp doesn't yet expose this yet but it makes sense to do so. Are you aware of how to configure esbuild?

@aoisummer
Copy link
Author

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
Copy link
Owner

sintaxi commented Jul 18, 2021

Thanks. I'll see what I can do.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants