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

feature request: support target for deno #2686

Closed
idanran opened this issue Nov 20, 2022 · 4 comments
Closed

feature request: support target for deno #2686

idanran opened this issue Nov 20, 2022 · 4 comments

Comments

@idanran
Copy link

idanran commented Nov 20, 2022

https://deno.land/manual@v1.28.1/node/npm_specifiers

"Deno 1.28 stabilizes support for npm specifiers, which allow you to use npm modules directly in Deno with a higher chance of compatibility than importing from CDN's, particularly if the modules depend on artifact files in their package."

@evanw
Copy link
Owner

evanw commented Nov 20, 2022

Sorry, I'm not sure I understand what you're proposing. You just linked to some documentation but didn't actually say anything yourself.

Are you asking for esbuild to implement a clone of Deno's npm package installer inside esbuild itself? That's something that isn't in scope for esbuild. Being a package manager is out of scope. If you want to augment esbuild's path resolution so that packages are automatically installed for you, then you should write your own plugin to do that: https://esbuild.github.io/plugins/

@idanran
Copy link
Author

idanran commented Nov 21, 2022

Sorry, I'm not sure I understand what you're proposing. You just linked to some documentation but didn't actually say anything yourself.

Are you asking for esbuild to implement a clone of Deno's npm package installer inside esbuild itself? That's something that isn't in scope for esbuild. Being a package manager is out of scope. If you want to augment esbuild's path resolution so that packages are automatically installed for you, then you should write your own plugin to do that: https://esbuild.github.io/plugins/

Well, thanks.

https://esbuild.github.io/api/#target

What I want to say is this "target".

@evanw
Copy link
Owner

evanw commented Nov 21, 2022

Adding deno as a valid value for target could make sense. I can do that.

However, keep in mind that the purpose of the target setting is to enable or disable JavaScript syntax features for the target JavaScript VM. For example, versions of Deno older than v1.2 don't support the new ||= operator, so adding e.g. --target=deno1.0 to esbuild would let you tell esbuild to transpile ||= to older JavaScript. The target setting doesn't have any effect on path resolution. Adding --target=deno1.0 to esbuild wouldn't do anything about Deno-specific npm specifiers at all.

@evanw evanw closed this as completed in ec9c3cf Nov 21, 2022
@idanran
Copy link
Author

idanran commented Nov 21, 2022

Adding deno as a valid value for target could make sense. I can do that.

However, keep in mind that the purpose of the target setting is to enable or disable JavaScript syntax features for the target JavaScript VM. For example, versions of Deno older than v1.2 don't support the new ||= operator, so adding e.g. --target=deno1.0 to esbuild would let you tell esbuild to transpile ||= to older JavaScript. The target setting doesn't have any effect on path resolution. Adding --target=deno1.0 to esbuild wouldn't do anything about Deno-specific npm specifiers at all.

I see. Thank you.

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