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

Consider adding esbuild's build function to plugin setup callback #1790

Closed
jed opened this issue Nov 21, 2021 · 2 comments
Closed

Consider adding esbuild's build function to plugin setup callback #1790

jed opened this issue Nov 21, 2021 · 2 comments

Comments

@jed
Copy link

jed commented Nov 21, 2021

I recently created this plugin to eagerly evaluate a module. It requires access to esbuild's underlying build function, and instead of making plugin consumers pass it in, I'd love esbuild to provide it in the setup callback.

ie, instead of requiring users to do this:

await build({
   entryPoints: ['app.js'],
   plugins: [myPlugin(build)]
})

I could have them do this:

await build({
   entryPoints: ['app.js'],
   plugins: [myPlugin]
})
@hyrious
Copy link

hyrious commented Nov 21, 2021

Just import esbuild by yourself:

import esbuild from 'esbuild'
esbuild.build()

I believe consumers have to ensure this code run in their environment (through import-maps or whatever), since esbuild itself is a normal es module.

@jed
Copy link
Author

jed commented Nov 21, 2021

i don't know what version the consumer of the plugin is running, and don't want to import two versions of esbuild (i'm not using npm).

@evanw evanw closed this as completed in 47cb45c Dec 4, 2021
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