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

[WIP]: chore(*): publish es versions of browser packages #12761

Closed
wants to merge 2 commits into from

Conversation

DSchau
Copy link
Contributor

@DSchau DSchau commented Mar 22, 2019

Description

In preparation for modern builds, we need to also publish some of our dependencies as es. We use microbundle to do that.

Currently blocked by microbundle using buble, which isn't able to minify everything as we'd want (e.g. class is still transpiled to function). This is supposed to be merged in next week or so upstream--so we'll wait for that.

Preliminary findings are that this shaves off a few kb (non-gzipped!) compared to the CommonJS transpiled version.

Note: We'll want to publish babel-preset-gatsby in a separate PR before this change.

Related Issues

@DSchau DSchau added the status: blocked This issue/PR can't be solved at the moment and shouldn't be closed/merged label Apr 9, 2019
@wardpeet wardpeet self-assigned this Apr 25, 2019
@DSchau
Copy link
Contributor Author

DSchau commented Jun 5, 2019

@wardpeet this is probably good to re-visit now that your microbundle PR was merged, right? Or at least I thought it was merged 🙃

@wardpeet
Copy link
Contributor

wardpeet commented Jun 6, 2019

Definitely! Modern builds PR #14289 has some babel-preset changes you might want to introduce here too. We should install microbundle@next which has the latest updates. With that all set we should be able to wrap this up.

@wardpeet wardpeet closed this Jun 6, 2019
@wardpeet wardpeet reopened this Jun 6, 2019
@wardpeet wardpeet requested review from philipp-spiess and removed request for philipp-spiess June 6, 2019 08:04
@wardpeet wardpeet removed their assignment Jun 6, 2019
@freiksenet
Copy link
Contributor

Is anything else needs to be done here @DSchau?

@DSchau
Copy link
Contributor Author

DSchau commented Jun 24, 2019

@freiksenet I'll need to pull it down again to check if microbundle has been updated.

I believe @wardpeet was making some upstream changes to enable Babel (instead of Buble) which will unblock us and we can ship this!

@DSchau DSchau force-pushed the feat/babel-preset-env branch from 8e7bd47 to ea1788e Compare July 8, 2019 15:38
@DSchau
Copy link
Contributor Author

DSchau commented Jul 8, 2019

OK, mostly working. Few notes:

  • Need to solve withIEPolyfill transpilation in gatsby-image (microbundle —entry fails with Error: You must set "output.dir" instead of "output.file" when generating multiple chunks as if it’s trying to parse the dynamic import statement or something; we just want it ignored
  • Still (weirdly) transpiling classes, so we’ll want to ensure the esmodules target makes sense

Some preliminary numbers (note: primarily these are because class and other features are still being transpiled)

Package Format Size
gatsby-image cjs 21kb
gatsby-image mjs 19kb
gatsby-link cjs 7.8Kb
gatsby-link mjs 7.1Kb

@DSchau
Copy link
Contributor Author

DSchau commented Aug 15, 2019

Let's close this -- when we're closer to implementing modern bundles, this will serve as a great reference implementation of one piece that will need to be done to maximize the benefit to end users.

@DSchau DSchau closed this Aug 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: blocked This issue/PR can't be solved at the moment and shouldn't be closed/merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants