Skip to content

Experimental / Closure => ES modules - transpiler #2

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

Draft
wants to merge 81 commits into
base: master
Choose a base branch
from

Conversation

Arxcis
Copy link
Owner

@Arxcis Arxcis commented Oct 16, 2020

Demo - Transpiling grpc-web from closure-modules to es-modules

asciicast

Demo - Loading all modules in browser

Loading all the transpiled ES modules works as intended, loading grpc-web and all its goog-deps in 1 second in Chromium.

index.html - https://github.com/Arxcis/grpc-web/blob/experimental/build-esm-package/packages/grpc-web/index.html

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8" />
  </head>
  <body></body>
  <script type="module">
    import * as grpc from "./es_modules/exports.js";
  </script>
</html>

demochrome

Known issue - Circular dependencies cause uninitialized top-level values

The closure library the code I have generated has circular dependencies, which leads to undefined values.
image

Dependency-graph shows circular dependencies in goog.events.events.js and goog.events.eventtype.js

image

Entire grpc-web dependency-graph.
graph

Command to generate graph

madge es_modules/exports.js -i graph.png

Known isssue - Naming conflict/aliasing in goog.useragent.useragent.js

I am considering prefixing all file-scope variables with goog. googUseragent in this case.
image

Arxcis added 30 commits October 16, 2020 21:06
- The pacakage declarations contain only re-exports
of modules within the package.
- This makes it easier to deal with modules
which exports multiple symbols.
- This makes it easier to deal with modules
which exports multiple symbols.
@Arxcis Arxcis changed the title Experimental - Make tool for building an esm package Experimental - Closure => ES modules - transpiler Oct 20, 2020
@Arxcis Arxcis changed the title Experimental - Closure => ES modules - transpiler Experimental / Closure => ES modules - transpiler Oct 20, 2020
@huan huan mentioned this pull request Aug 29, 2021
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

Successfully merging this pull request may close these issues.

1 participant