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

Pass options to esbuild #34

Open
dominik-zeglen opened this issue Apr 5, 2023 · 1 comment
Open

Pass options to esbuild #34

dominik-zeglen opened this issue Apr 5, 2023 · 1 comment

Comments

@dominik-zeglen
Copy link

So i have this use case that somewhere in the code I'm importing some .svg files and at this moment esrun doesn't seem to have ability to add empty loader for these. Would it be possible to do something like this?

$ npx @digitak/esrun --esbuild-loader:.svg=empty script.ts
@Gin-Quin
Copy link
Contributor

I tried to implement this, but it's complicated because Esrun and Esbuild do not have the same way of handling CLI parameters. It would be fine when you pass only one parameter, but hard and buggy if you would try to pass an array of parameters.

I advise you to create a script for that:

// myScript.ts
import esrun from "@digitak/esrun"

esrun("path/to/script.ts", {
  esbuildOptions: {
    // ... well-typed esbuild options
  }
})

You need the latest version to add the options this way.

You can the run this script with esrun itself (that's esrunception 😄).

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