google/closure-compiler

Add an Option To Prevent Rewriting Import/Require Statements for Specific Modules

Open

#1382 aperta il 10 gen 2016

Vedi su GitHub
 (10 commenti) (5 reazioni) (0 assegnatari)Java (1197 fork)batch import
help wanted

Metriche repository

Star
 (7176 star)
Metriche merge PR
 (Merge medio 3g 4h) (1 PR mergiata in 30 g)

Descrizione

When working with module systems, there needs to be some way to designate that certain import statements are intended to be runtime imports rather than compile time. This will only apply to CommonJS modules currently until such a time as the compiler recognizes and rewrites the WhatWG Loader Import Statements. See

The consensus around this discussion seems to be that this should be a flag, rather than an annotation.

The flag should meet the following criteria:

  • The same flag should work for ES6 and CommonJS modules
  • It MUST take into account all of the following cases:
    • The --module flags are used and thus both the import and export statements are provided to the compiler as input but divided into separate outputs for runtime loading
    • The export statement is not provided to the compiler and is therefore external code. This covers core NodeJS module imports.

Guida contributor