Skip to main content

generated_export_key

Function generated_export_key 

Source
pub async fn generated_export_key(
    module: ResolvedVc<Box<dyn EcmascriptChunkPlaceable>>,
    chunking_context: Vc<Box<dyn ChunkingContext>>,
    export: &RcStr,
) -> Result<RcStr>
Expand description

The key that generated code has to use to read export from module — the mangled key when the module’s exports are mangled, and export itself otherwise.

Every piece of code generation that materializes an export access as a string has to get its key from here, or the access will miss when the module is mangled. That includes generated source text (__turbopack_require__(id)["default"](…) and friends) as well as AST built by hand. Code that goes through ReferencedAssetIdent (see super::base) is already covered.

module must be the module that actually produces the export. For a re-export, resolve to the producing module first (as ReferencedAsset::get_ident_inner does), because each module mangles its own keys independently.