@Stability(value=Experimental) public static final class BundlingOptions.Builder extends Object implements software.amazon.jsii.Builder<BundlingOptions>
BundlingOptions| Constructor and Description |
|---|
Builder() |
@Stability(value=Experimental) public BundlingOptions.Builder banner(String banner)
BundlingOptions.getBanner()banner - Use this to insert an arbitrary string at the beginning of generated JavaScript files.
This is similar to footer which inserts at the end instead of the beginning.
This is commonly used to insert comments:
this@Stability(value=Experimental) public BundlingOptions.Builder buildArgs(Map<String,String> buildArgs)
BundlingOptions.getBuildArgs()buildArgs - Build arguments to pass when building the bundling image.this@Stability(value=Experimental) public BundlingOptions.Builder commandHooks(ICommandHooks commandHooks)
BundlingOptions.getCommandHooks()commandHooks - Command hooks.this@Stability(value=Experimental) public BundlingOptions.Builder define(Map<String,String> define)
BundlingOptions.getDefine()define - Replace global identifiers with constant expressions.this@Stability(value=Experimental) public BundlingOptions.Builder dockerImage(DockerImage dockerImage)
BundlingOptions.getDockerImage()dockerImage - A custom bundling Docker image.
This image should have esbuild installed globally. If you plan to use nodeModules
it should also have npm or yarn depending on the lock file you're using.
See https://github.com/aws/aws-cdk/blob/master/packages/%40aws-cdk/aws-lambda-nodejs/lib/Dockerfile for the default image provided by @aws-cdk/aws-lambda-nodejs.
this@Stability(value=Experimental) public BundlingOptions.Builder environment(Map<String,String> environment)
BundlingOptions.getEnvironment()environment - Environment variables defined when bundling runs.this@Stability(value=Experimental) public BundlingOptions.Builder esbuildVersion(String esbuildVersion)
BundlingOptions.getEsbuildVersion()esbuildVersion - The version of esbuild to use when running in a Docker container.this@Stability(value=Experimental) public BundlingOptions.Builder externalModules(List<String> externalModules)
BundlingOptions.getExternalModules()externalModules - A list of modules that should be considered as externals (already available in the runtime).this@Stability(value=Experimental) public BundlingOptions.Builder footer(String footer)
BundlingOptions.getFooter()footer - Use this to insert an arbitrary string at the end of generated JavaScript files.
This is similar to banner which inserts at the beginning instead of the end.
This is commonly used to insert comments
this@Stability(value=Experimental) public BundlingOptions.Builder forceDockerBundling(Boolean forceDockerBundling)
BundlingOptions.getForceDockerBundling()forceDockerBundling - Force bundling in a Docker container even if local bundling is possible.
This is useful if your function relies on node modules
that should be installed (nodeModules) in a Lambda compatible
environment.this@Stability(value=Experimental) public BundlingOptions.Builder keepNames(Boolean keepNames)
BundlingOptions.getKeepNames()keepNames - Whether to preserve the original `name` values even in minified code.
In JavaScript the name property on functions and classes defaults to a
nearby identifier in the source code.
However, minification renames symbols to reduce code size and bundling
sometimes need to rename symbols to avoid collisions. That changes value of
the name property for many of these cases. This is usually fine because
the name property is normally only used for debugging. However, some
frameworks rely on the name property for registration and binding purposes.
If this is the case, you can enable this option to preserve the original
name values even in minified code.
this@Stability(value=Experimental) public BundlingOptions.Builder loader(Map<String,String> loader)
BundlingOptions.getLoader()loader - Use loaders to change how a given input file is interpreted.
Configuring a loader for a given file type lets you load that file type with
an import statement or a require call.this@Stability(value=Experimental) public BundlingOptions.Builder logLevel(LogLevel logLevel)
BundlingOptions.getLogLevel()logLevel - Log level for esbuild.this@Stability(value=Experimental) public BundlingOptions.Builder metafile(Boolean metafile)
BundlingOptions.getMetafile()metafile - This option tells esbuild to write out a JSON file relative to output directory with metadata about the build.
The metadata in this JSON file follows this schema (specified using TypeScript syntax):
// Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826
{outputs: {
[path: string]: {
bytes: number
inputs: {
[path: string]: { bytesInOutput: number }
}
imports: { path: string }[]
exports: string[]
}
}
}
This data can then be analyzed by other tools. For example, bundle buddy can consume esbuild's metadata format and generates a treemap visualization of the modules in your bundle and how much space each one takes up.
this@Stability(value=Experimental) public BundlingOptions.Builder minify(Boolean minify)
BundlingOptions.getMinify()minify - Whether to minify files when bundling.this@Stability(value=Experimental) public BundlingOptions.Builder nodeModules(List<String> nodeModules)
BundlingOptions.getNodeModules()nodeModules - A list of modules that should be installed instead of bundled.
Modules are
installed in a Lambda compatible environment only when bundling runs in
Docker.this@Stability(value=Experimental) public BundlingOptions.Builder sourceMap(Boolean sourceMap)
BundlingOptions.getSourceMap()sourceMap - Whether to include source maps when bundling.this@Stability(value=Experimental) public BundlingOptions.Builder target(String target)
BundlingOptions.getTarget()target - Target environment for the generated JavaScript code.this@Stability(value=Experimental) public BundlingOptions.Builder tsconfig(String tsconfig)
BundlingOptions.getTsconfig()tsconfig - Normally the esbuild automatically discovers `tsconfig.json` files and reads their contents during a build.
However, you can also configure a custom tsconfig.json file to use instead.
This is similar to entry path, you need to provide path to your custom tsconfig.json.
This can be useful if you need to do multiple builds of the same code with different settings.
this@Stability(value=Experimental) public BundlingOptions build()
build in interface software.amazon.jsii.Builder<BundlingOptions>BundlingOptionsNullPointerException - if any required attribute was not providedCopyright © 2021. All rights reserved.