Show / Hide Table of Contents

Class SourceMapMode

SourceMap mode for esbuild.

Inheritance
System.Object
SourceMapMode
Namespace: Amazon.CDK.AWS.Lambda.Nodejs
Assembly: Amazon.CDK.AWS.Lambda.Nodejs.dll
Syntax (csharp)
public sealed class SourceMapMode : Enum
Syntax (vb)
Public NotInheritable Class SourceMapMode
    Inherits

     Enum
Remarks

See: https://esbuild.github.io/api/#sourcemap

ExampleMetadata: infused

Examples
new NodejsFunction(this, "my-handler", new NodejsFunctionProps {
    Bundling = new BundlingOptions {
        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 = new Dictionary<string, string> {  // Use the 'dataurl' loader for '.png' files
            { ".png", "dataurl" } },
        Define = new Dictionary<string, string> {  // 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 = new [] { "module", "main" },  // prefer ECMAScript versions of dependencies
        Inject = new [] { "./my-shim.js", "./other-shim.js" },  // allows to automatically replace a global variable with an import from another file
        EsbuildArgs = new Dictionary<string, object> {  // Pass additional arguments to esbuild
            { "--log-limit", "0" },
            { "--splitting", true } }
    }
});

Synopsis

Fields

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.

value__

Fields

BOTH

Both sourceMap mode - If you want to have the effect of both inline and external simultaneously.

public const SourceMapMode BOTH
Field Value
Type Description
SourceMapMode

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.

public const SourceMapMode DEFAULT
Field Value
Type Description
SourceMapMode

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.

public const SourceMapMode EXTERNAL
Field Value
Type Description
SourceMapMode

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.

public const SourceMapMode INLINE
Field Value
Type Description
SourceMapMode

value__

public int value__
Field Value
Type Description
System.Int32
Back to top Generated by DocFX