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

Deno.emit() allow specifying "externals" that should not be bundled. #51

Open
vovacodes opened this issue Jun 28, 2021 · 1 comment
Open

Comments

@vovacodes
Copy link

I'm trying to create a bundle for my frontend app with Deno.emit(). I'm using a bunch of dependencies from jspm which I don't want to include into the bundle and let the browser import them instead. This would allow me to leverage the caching benefits coming from using a CDN.

swc_bundler that's used under the hood in Deno.emit() already supports it: https://github.com/swc-project/swc/blob/4e7723a7a0286f49124e7dc1ca10668ad6a237a9/bundler/src/bundler/mod.rs#L34 so it should be pretty straight-forward to add it to Deno. I'm also happy to take on this if you are happy with the proposal.

I was thinking about adding the external_modules option to EmitOptions that mimics one of swc_bundler and accepts an array of absolutely resolved module specifiers but I think a better option could be a function that gets the module specifier in and tells if it should be external or not.
Maybe it can be the same load function proposed here: denoland/deno#9866 but using some special return value indicating the module import should be left intact. What do you think?

@kitsonk
Copy link
Contributor

kitsonk commented Jun 29, 2021

It is strongly related to denoland/deno#9866, but there has been some debate internally with the core team about the roadmap with Deno.emit(). I plan to come up with a stronger proposal in the very near future and will include trying to address this use case as part of that proposal. We need to get alignment with the general direction with Deno.emit() before anyone expends any effort trying to implement more features.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants