@Generated(value="jsii-pacmak/1.74.0 (build 6d08790)", date="2023-03-14T16:25:30.133Z") @Stability(value=Stable) public enum SourceMapMode extends Enum<SourceMapMode>
Example:
NodejsFunction.Builder.create(this, "my-handler")
.bundling(BundlingOptions.builder()
.minify(true) // minify code, defaults to false
.sourceMap(true) // include source map, defaults to false
.sourceMapMode(SourceMapMode.INLINE) // defaults to SourceMapMode.DEFAULT
.sourcesContent(false) // do not include original source into source map, defaults to true
.target("es2020") // target environment for the generated JavaScript code
.loader(Map.of( // Use the 'dataurl' loader for '.png' files
".png", "dataurl"))
.define(Map.of( // Replace strings during build time
"process.env.API_KEY", JSON.stringify("xxx-xxxx-xxx"),
"process.env.PRODUCTION", JSON.stringify(true),
"process.env.NUMBER", JSON.stringify(123)))
.logLevel(LogLevel.SILENT) // defaults to LogLevel.WARNING
.keepNames(true) // defaults to false
.tsconfig("custom-tsconfig.json") // use custom-tsconfig.json instead of default,
.metafile(true) // include meta file, defaults to false
.banner("/* comments */") // requires esbuild >= 0.9.0, defaults to none
.footer("/* comments */") // requires esbuild >= 0.9.0, defaults to none
.charset(Charset.UTF8) // do not escape non-ASCII characters, defaults to Charset.ASCII
.format(OutputFormat.ESM) // ECMAScript module output format, defaults to OutputFormat.CJS (OutputFormat.ESM requires Node.js 14.x)
.mainFields(List.of("module", "main")) // prefer ECMAScript versions of dependencies
.inject(List.of("./my-shim.js", "./other-shim.js")) // allows to automatically replace a global variable with an import from another file
.esbuildArgs(Map.of( // Pass additional arguments to esbuild
"--log-limit", "0",
"--splitting", true))
.build())
.build();
| Enum Constant and Description |
|---|
BOTH
Both sourceMap mode - If you want to have the effect of both inline and external simultaneously.
|
DEFAULT
Default sourceMap mode - will generate a .js.map file alongside any generated .js file and add a special //# sourceMappingURL= comment to the bottom of the .js file pointing to the .js.map file.
|
EXTERNAL
External sourceMap mode - If you want to omit the special //# sourceMappingURL= comment from the generated .js file but you still want to generate the .js.map files.
|
INLINE
Inline sourceMap mode - If you want to insert the entire source map into the .js file instead of generating a separate .js.map file.
|
| Modifier and Type | Method and Description |
|---|---|
static SourceMapMode |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static SourceMapMode[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
@Stability(value=Stable) public static final SourceMapMode DEFAULT
@Stability(value=Stable) public static final SourceMapMode EXTERNAL
@Stability(value=Stable) public static final SourceMapMode INLINE
@Stability(value=Stable) public static final SourceMapMode BOTH
public static SourceMapMode[] values()
for (SourceMapMode c : SourceMapMode.values()) System.out.println(c);
public static SourceMapMode valueOf(String name)
name - the name of the enum constant to be returned.IllegalArgumentException - if this enum type has no constant with the specified nameNullPointerException - if the argument is nullCopyright © 2023. All rights reserved.