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

[META] Support ES Modules #1640

Closed
marcoscaceres opened this issue Apr 27, 2018 · 7 comments
Closed

[META] Support ES Modules #1640

marcoscaceres opened this issue Apr 27, 2018 · 7 comments

Comments

@marcoscaceres
Copy link
Contributor

marcoscaceres commented Apr 27, 2018

When Firefox 60 lands in May, we will have ES module support across all target browsers. That means we can start considering using them in ReSpec.

We should evaluate what that means for our current plugin design and for the dependencies (which are not ES Modules). With dynamic import() support, we can basically get rid of RequireJS.

Ideally, we would then have ReSpec do this:

  1. load a light stub (or some kind of master stub) for a plugin. These stubs intelligently determine if a plugin is needed: for example, "does this document require syntax highlighting? does this document use WebIDL?" and so on..
  2. For each "yes" stub, it would asynchronously kick off download of each needed module. These modules would have good cache control headers set (we could serve them from either the W3C server, or via respec.org, where we control the HTTP cache settings).
  3. Then we split the modules into group: needs further processing (e.g., anything that needs xrefs), or standalone (e.g., caniuse).

Just some lose thoughts for now... but it's exciting because potentially this will make ReSpec super tiny, with each spec only loading just what it needs. Right now, we load everything, and that's super wasteful. The modules can be cached, and shared across specs... that may lead to interesting versioning issues, but we can deal with that.

Thoughts?

@saschanaz
Copy link
Collaborator

A downside is more round trips for the first visit, which is probably okay.

@marcoscaceres
Copy link
Contributor Author

marcoscaceres commented Apr 30, 2018

A downside is more round trips for the first visit, which is probably okay.

Yeah, I think that's fine. We can measure the difference too.

@saschanaz
Copy link
Collaborator

saschanaz commented May 9, 2018

Firefox 60 has landed 🎉

Edit: An interesting support indicator https://aremodulesready.com/

@saschanaz
Copy link
Collaborator

saschanaz commented May 13, 2018

With dynamic import() support

It seems MSEdge on April 2018 update does not support dynamic import() yet. (Still disabled by default)

@saschanaz
Copy link
Collaborator

@marcoscaceres You recently said you are planning to use Webpack/Rollup. Do we still ultimately want to do ES modules then?

@marcoscaceres
Copy link
Contributor Author

Do we still ultimately want to do ES modules then?

I think ultimately, yes. But we need to trial it to see if they are fast enough (I think they will be... but we need to do some tests). We are still waiting on import().

@marcoscaceres
Copy link
Contributor Author

Closing, as I think we will still want to bundle everything for the foreseeable future.

We can always look at this again down the road... and, in fact, it kinda already works... we just don't deploy ReSpec this way.

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