0

I am trying to use Closure compiler to concatenate javascript files - possibly before code optimization for better results in code optimization. I am new to closure and I cant find a way to concatenate js files with closure. I would love it if its possible to write a closure script to concatenate files, move them between folders etc.

Here's an example of what I'm looking for: These are three js files

//A.js
 require ("B");
 require ("C");
 function x(){...} //Calls y() and calls z()

//B.js
 require ("C");
 export function y(){...} //Calls z()

//C.js
 export function z(){...}

Concatenate B.js and C.js into one file and make it look like this:

//A.js
 require ("B");
 function x(){...} //Calls y() and calls z()

//B.js
 export module B{
   export function y(){...} //Calls z()
   export function z(){...}
 }

After this restructuring I would like closure to optimize and obfuscate A.js and B.js

EternallyCurious
  • 2,345
  • 7
  • 47
  • 78

1 Answers1

0

The Closure Compiler doesn't yet support EcmaScript 6 modules. And I believe that ES6 dropped the "module" literal. Did you mean to use ES6 syntax?

John
  • 5,443
  • 15
  • 21