folke / esbuild-runner

⚡️ Super-fast on-the-fly transpilation of modern JS, TypeScript and JSX using esbuild
https://www.npmjs.com/package/esbuild-runner
Apache License 2.0
711 stars 24 forks source link

add support for esbuild options #14

Closed mulfyx closed 3 years ago

mulfyx commented 3 years ago

maybe add support for passing esbuild options for 'install' functions? like this:

const { install } = require('esbuild-runner');

install({
  type: 'transform',
  debug: false,
  esbuild: {
    target: 'esnext',
    plugins: [...]
  }
});
glromeo commented 3 years ago

although an API could be nice, given that esbuild-runner is already well integrated with Jest I sponsor a config file e.g: esbuild.config.js

module.exports = {
    target: 'esnext',
    plugins: [...]
}
folke commented 3 years ago

I'll see if I can add both the extra options to the API and the config file

seangenabe commented 3 years ago

I'm running into issues regarding evaluating CommonJS and this would probably help.

folke commented 3 years ago

I just made a new release that supports passing options to the API and reading of esbuild.config.js

pincman commented 3 years ago

@folke error: Cannot use plugins in synchronous API calls