I can import the closure-compiler like this:
const ClosureCompiler = require('google-closure-compiler').compiler;
but that uses the java version. I have a limitation on the build machines at work such that I can't make use of java. I was hoping to force the compilation to use the native version. I've tried doing something like this:
const ClosureCompiler = require('google-closure-compiler-osx').compiler;
That seems to result in ClosureCompiler being undefined. I've gone around and around trying to find any documentation on the API exposed to javascript but I keep coming up with nothing.
If anyone has an idea about how to force native compilation rather than java compilation it would be much appreciated.
I think I've made some progress on this by looking at what's going on in the cli.js and util.js files inside node_modules/google-closer-compiler.
This pattern appears to be working: