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

Import map support #241

Closed
newtack opened this issue Jul 8, 2020 · 3 comments
Closed

Import map support #241

newtack opened this issue Jul 8, 2020 · 3 comments

Comments

@newtack
Copy link

newtack commented Jul 8, 2020

I would like to do bundle free development (ESM dev server) and then use esbuild for production bundles.

For development I am planning to use import maps, as shown in this example:
https://deno.land/x/dev_server/template/react (see import_map.json file).

Can I use that same import map for esbuild?

@evanw
Copy link
Owner

evanw commented Jul 14, 2020

I'm not sure what you're proposing. Are you saying that you would like these packages to be bundled in production builds but not in development builds? The most straightforward way to do this would be to just install those packages in node_modules. Then esbuild (and any other node-compatible build tool) will pick them up automatically and use them without needing import maps.

I'm not familiar with Deno myself but are you using that? If so, why do you need esbuild? I've heard that it comes with its own bundler and that they're going to be writing everything in Rust. In that case I'd expect esbuild would not have a huge speed advantage like it does with other tools. In that case it might be best to just use the bundler built in to Deno instead.

If you do need import maps with esbuild, it sounds like you're expecting esbuild to automatically download the linked packages and their dependencies transitively with a built-in network cache. This sounds like a good thing to experiment with in a plugin since it seems sufficiently complex and potentially use-case specific. I'm currently working on a plugin API (see #111) and this kind of thing should be possible once that lands.

@newtack
Copy link
Author

newtack commented Jul 14, 2020

Thanks Evan. Yes, we are in the process of moving to Deno and definitely away from Webpack :-)

I assumed that the Deno based bundler was more optimized for server bundles, but you are probably right that it may be used for client bundles too. Let me check this out.

I like your plugin API approach and this may be a solution going forward.

@newtack newtack closed this as completed Jul 14, 2020
@steamwings
Copy link

steamwings commented Mar 10, 2023

Perhaps this is more pertinent now that Deno's bundler is deprecated. That webpage specifically recommends esbuild. It would be really nice if I could easily configure esbuild to work with the new deno.json import map, but I'll give the plugins a try.

While I'm here, thanks for all the great work on this project!

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

3 participants