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

Moment example is too large #22

Closed
alexeagle opened this issue Apr 18, 2017 · 7 comments
Closed

Moment example is too large #22

alexeagle opened this issue Apr 18, 2017 · 7 comments

Comments

@alexeagle
Copy link
Owner

alexeagle commented Apr 18, 2017

153kb of the bundle is just to get moment().format()
taasxgyvux8

@kylecordes
Copy link
Collaborator

@alexeagle There is some kind of empty link or broken image in here.

@alexeagle
Copy link
Owner Author

The strategy I'd like to pursue is to change the usage site to
import * as moment from 'moment'
then point the compiler to the moment sources:

--js node_modules/moment/src/**.js
--js_module_root=node_modules/moment/src

but it doesn't work yet, first issue is the cyclical dependency I just linked

@kylecordes
Copy link
Collaborator

What about the following variation?

  • Start with source code of recalcitrant library
  • Process it through Babel then Rollup, both configured in a way that resolves any circular dependencies and attempts to compile away any language constructs that give Closure difficulty
  • Feed the results into Closure

(In addition to complexity though, this has a probably deeper problem. Tools that process code, usually do so by adding more layers of wrapping around constructs already there. I don't know if any of the available tools could, for example, reason about CommonJS code enough to come up with something like to a FESM module as output.)

@alexeagle
Copy link
Owner Author

alexeagle commented Apr 18, 2017 via email

@kylecordes
Copy link
Collaborator

Oh, actually I was trying to suggest my middle step as a way to avoid having to repackage a library. Get the source code (hopefully included in the package, though sometimes is not there, example RxJS). Have some process to run it through that does a decent job consuming a wide variety of source code, and feed that into Closure. That way Closure doesn't have to carry the whole burden of being able to directly consume the vast variety of constructs found in the wild.

I might be overthinking it though. Maybe I (actually all of us who have commented on any of this) have simply been unlucky and picked a first handful of packages that are particularly difficult to persuade Closure to absorb. Obviously be fantastic if what you describe, works in general.

@kylecordes
Copy link
Collaborator

(making another issue for other libs, this one is Moment.)

@alexeagle
Copy link
Owner Author

Moved to current demo repo

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