3

When I build my js project with the Google Closure Builder (SIMPLE_OPTIMIZATIONS), closure include the base.js file in the compiled js file. I dont use the closure-lib. Only goog.provide and goog.require. Is there any way to prevent this insertion?

2 Answers2

2

goog.provide and goog.require calls are part of Closure-library. The definitions are provided in base.js. While I realize that the compiler removes the goog.require calls as part of the compilation, goog.provide has an actual implementation (your code wouldn't work without it).

If you were to use ADVANCED_OPTIMIZATIONS, then dead code elimination would remove all of the unused sections of base.js. However, not all code lends itself to compilation with ADVANCED_OPTIMIZATIONS.

You could create your own copy of base.js and only include the necessary definitions.

Chad Killingsworth
  • 14,360
  • 2
  • 34
  • 57
1

Kjscompiler has annotation to ignore files and consider them as external: https://github.com/knyga/kjscompiler

Oleksandr Knyga
  • 625
  • 9
  • 9