Skip to content

LOOSE mode includes ES6 modules that aren't imported by the entry point #2590

Closed
@ghost

Description

I'm trying to convert our code from goog.provide modules to ES6 modules, but I've run into a difference in behavior that I didn't expect. When running in LOOSE dependency mode, the compiler includes all ES6 modules regardless of whether they're a dependency of the entry point. When I used goog.provide, these files were excluded from compilation. Based on https://github.com/google/closure-compiler/wiki/Managing-Dependencies#working-with-files-that-do-not-specify-dependencies, I'd expect the ES6 modules to work the way goog.provide modules do.

Running in STRICT mode eliminates files that aren't imported by the entry point, but it also eliminates non-module files (as expected). We have some non-module legacy files that we include in some of our builds, so I don't want to switch to STRICT if I can avoid it.

Can you make ES6 modules work like goog.provide, or at least clarify that section of the wiki?

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions