-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Description
Consider the following files:
greet.js:
function greet(msg) { console.log(msg); } exports.greet = greet;
hellogreet.js:
function hellogreet(msg) { console.log("Hello " + msg); } exports.hellogreet = hellogreet;
entrygreet.js:
const greetmod = require("./greet.js"); const myname = "John Doe"; greetmod.greet(myname);
Compile the files with the following command line:
java -jar closure-compiler.jar --formatting PRETTY_PRINT --compilation_level SIMPLE_OPTIMIZATIONS --process_common_js_modules --dependency_mode LOOSE entrygreet.js greet.js hellogreet.js
Expected behaviour: The output should only include contents of files entrygreet.js and greet.js.
Acutal behaviour: The output includes contents of all 3 files, including hellogreet.js.
--dependency_mode LOOSE should add all files that do not goog.provide a namespace and are not modules as --entry_point entries. In this case it is file entrygreet.js. This file depends only on greet.js and nothing depends on hellogreet.js. Therefore the generated output should definitely not include contents of hellogreet.js. So it seems --dependency_mode LOOSE is broken and acts just like --dependency_mode SORT_ONLY.
Can you please investigate and fix the problem?