Skip to content

--dependency_mode LOOSE does not work #3510

@je-mos

Description

@je-mos

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    internal-issue-createdAn internal Google issue has been created to track this GitHub issuetriage-doneHas been reviewed by someone on triage rotation.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions