An ECMAScript module that can be changed by a third party.
This class presents a convenient API for consumers to add common transforms to ES Modules in a semantic way.
-
TargetableESModule
- .addImport(statement) ⇒
SingleImportStatement - .uniqueIdentifier(binding) ⇒
string - .wrapWithFile([exportName], wrapperModule) ⇒
this
- .addImport(statement) ⇒
Adds a static import statement to the module source code, thus importing a new dependency.
This method automatically deduplicates attempts to add imports that would override earlier import bindings. If a collision is detected, it renames the binding before inserting it.
Returns: SingleImportStatement — An instance of the SingleImportStatement class.
Parameters
string | SingleImportStatementGenerates a unique identifier for a given binding. Not guaranteed safe, but good enough in a pinch.
Returns: Parameters
stringPass exports of this module through a wrapper module.
Chainable
Returns: Parameters
stringstringSource Code: pwa-studio/packages/pwa-buildpack/lib/WebpackTools/targetables/TargetableESModule.js