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

Is there a way to only have ESM in the compiled output? #984

Open
NullVoxPopuli opened this issue Sep 27, 2021 · 3 comments
Open

Is there a way to only have ESM in the compiled output? #984

NullVoxPopuli opened this issue Sep 27, 2021 · 3 comments

Comments

@NullVoxPopuli
Copy link
Collaborator

This is very related to also wanting different behavior depending on whether in a classic build environment with requirejs, vs ESM-only -- but I need to be certain I can get ESM-only builds.

buuut maybe a part of bundling is de-moduling some of the on-file-system modules?

My end goal is to be able to define import X from '@ember/whatever' (at runtime), and have the correct module resolved -- for example, I know that @ember/service exists at runtime -- so I should be able to import('@ember/service'), yeah?

@NullVoxPopuli
Copy link
Collaborator Author

I think I figured that I need to output all the modules I expect to exist as actual modules during the build... And I can do that myself with custom build processes.. but, I guess:

  • is there a way to detect if this has happened in the parent app (if possible, so I can reuse the parent app's modules)
  • is there a way to opt out of bundling entirely, or is this something I'd need to wait for Vite for?

@ef4
Copy link
Contributor

ef4 commented Sep 27, 2021

You can provide your own extremely minimalist "bundler" that doesn't do much bundling. This is what mho does for example, as a tech demo that's not really robust yet.

The quickest way to get experimenting would be to use import maps to get bare package imports working in the browser. You will of course need to unravel layers of history, because there's a lot of stuff in the ecosystem that doesn't truly follow the module spec under the hood.

@NullVoxPopuli
Copy link
Collaborator Author

NullVoxPopuli commented Dec 6, 2021

Posting this for reference of what I'm trying to do (and so I can close the tab I had this written up in): REPL where I import from ember-resources (a v2 addon) from skypack

image

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