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

Support Run-time import paths / template literals in Bun.build() #14877

Open
kernoeb opened this issue Oct 28, 2024 · 2 comments
Open

Support Run-time import paths / template literals in Bun.build() #14877

kernoeb opened this issue Oct 28, 2024 · 2 comments
Labels
enhancement New feature or request

Comments

@kernoeb
Copy link

kernoeb commented Oct 28, 2024

What is the problem this feature would solve?

Esbuild support bundling template string import : evanw/esbuild#56 (comment)

let translation = await import(`./engines/${engine}.js`)

What is the feature you are proposing to solve the problem?

Esbuild transforms the code to something like this :

var globImport_engines_ts = __glob({
  "./engines/engine1.ts": () => Promise.resolve().then(() => (init_engine1(), engine1_exports)),
  "./engines/engine2.ts": () => Promise.resolve().then(() => (init_engine2(), engine2_exports)),
  "./engines/engine3.ts": () => Promise.resolve().then(() => (init_engine3(), engine3_exports))
});

What alternatives have you considered?

No response

@kernoeb kernoeb added the enhancement New feature or request label Oct 28, 2024
@kernoeb kernoeb changed the title Support Run-time import paths / template string in Bun.build() Support Run-time import paths / template literals in Bun.build() Oct 28, 2024
@Jarred-Sumner
Copy link
Collaborator

If you use --minify-syntax or minifySyntax: true, does it work?

@kernoeb
Copy link
Author

kernoeb commented Oct 28, 2024

Image

If you're talking about the "minifySyntax" from esbuild, it works with this too

If you're talking about the "minify.syntax" from Bun, it doesn't work either, the template literal is kept in the builded javascript file

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

No branches or pull requests

2 participants