nodejs / node-eps

Node.js Enhancement Proposals for discussion on future API additions/changes to Node core
442 stars 66 forks source link

"tree shaking" on nodejs #59

Closed unional closed 7 years ago

unional commented 7 years ago

Have it / can it / should it be considered?

The only benefit seems to be saving some memory consumption for the module resolution. But if all references are resolved at runtime, then there is no benefit to be observed?

Or this may be fit into a larger discussion of "when to build"? 🌷

jacktuck commented 7 years ago

I think this is more userland tbh.

Have you taken a look at prepack or closure compiler?

dead-claudia commented 7 years ago

This could only really be implemented at the VM level (V8), because it requires substantial static analysis. Also, it can't actually avoid loading or creating anything observable without implementor hooks (e.g. .on("unhandledRejection", ...)), because that would be in violation of the ES spec.

So IMHO this is something best asked on the es-discuss mailing list and the like, not here.

bnoordhuis commented 7 years ago

Answered, closing.