Class AddBundleOptions.Builder
- java.lang.Object
-
- io.github.cdklabs.projen.javascript.AddBundleOptions.Builder
-
- All Implemented Interfaces:
software.amazon.jsii.Builder<AddBundleOptions>
- Enclosing interface:
- AddBundleOptions
@Stability(Experimental) public static final class AddBundleOptions.Builder extends Object implements software.amazon.jsii.Builder<AddBundleOptions>
A builder forAddBundleOptions
-
-
Constructor Summary
Constructors Constructor Description Builder()
-
Method Summary
-
-
-
Method Detail
-
platform
@Stability(Experimental) public AddBundleOptions.Builder platform(String platform)
Sets the value ofAddBundleOptions.getPlatform()- Parameters:
platform- esbuild platform. This parameter is required.- Returns:
this
-
target
@Stability(Experimental) public AddBundleOptions.Builder target(String target)
Sets the value ofAddBundleOptions.getTarget()- Parameters:
target- esbuild target. This parameter is required.- Returns:
this
-
executable
@Stability(Experimental) public AddBundleOptions.Builder executable(Boolean executable)
Sets the value ofAddBundleOptions.getExecutable()- Parameters:
executable- Mark the output file as executable.- Returns:
this
-
format
@Stability(Experimental) public AddBundleOptions.Builder format(String format)
Sets the value ofAddBundleOptions.getFormat()- Parameters:
format- Output format for the generated JavaScript files. There are currently three possible values that can be configured:"iife","cjs", and"esm".If not set (
undefined), esbuild picks an output format for you based onplatform:"cjs"ifplatformis"node""iife"ifplatformis"browser""esm"ifplatformis"neutral"
Note: If making a bundle to run under node with ESM, set
formatto"esm"instead of settingplatformto"neutral".- Returns:
this
-
loaders
@Stability(Experimental) public AddBundleOptions.Builder loaders(Map<String,String> loaders)
Sets the value ofAddBundleOptions.getLoaders()- Parameters:
loaders- Map of file extensions (without dot) and loaders to use for this file type. Loaders are appended to the esbuild command by--loader:.extension=loader- Returns:
this
-
outfile
@Stability(Experimental) public AddBundleOptions.Builder outfile(String outfile)
Sets the value ofAddBundleOptions.getOutfile()- Parameters:
outfile- Bundler output path relative to the asset's output directory.- Returns:
this
-
tsconfigPath
@Stability(Experimental) public AddBundleOptions.Builder tsconfigPath(String tsconfigPath)
Sets the value ofAddBundleOptions.getTsconfigPath()- Parameters:
tsconfigPath- The path of the tsconfig.json file to use for bundling.- Returns:
this
-
externals
@Stability(Experimental) public AddBundleOptions.Builder externals(List<String> externals)
Sets the value ofBundlingOptions.getExternals()- Parameters:
externals- You can mark a file or a package as external to exclude it from your build. Instead of being bundled, the import will be preserved (using require for the iife and cjs formats and using import for the esm format) and will be evaluated at run time instead.This has several uses. First of all, it can be used to trim unnecessary code from your bundle for a code path that you know will never be executed. For example, a package may contain code that only runs in node but you will only be using that package in the browser. It can also be used to import code in node at run time from a package that cannot be bundled. For example, the fsevents package contains a native extension, which esbuild doesn't support.
- Returns:
this
-
sourcemap
@Stability(Experimental) public AddBundleOptions.Builder sourcemap(Boolean sourcemap)
Sets the value ofBundlingOptions.getSourcemap()- Parameters:
sourcemap- Include a source map in the bundle.- Returns:
this
-
watchTask
@Stability(Experimental) public AddBundleOptions.Builder watchTask(Boolean watchTask)
Sets the value ofBundlingOptions.getWatchTask()- Parameters:
watchTask- In addition to thebundle:xyztask, createsbundle:xyz:watchtask which will invoke the same esbuild command with the--watchflag. This can be used to continusouly watch for changes.- Returns:
this
-
build
@Stability(Experimental) public AddBundleOptions build()
Builds the configured instance.- Specified by:
buildin interfacesoftware.amazon.jsii.Builder<AddBundleOptions>- Returns:
- a new instance of
AddBundleOptions - Throws:
NullPointerException- if any required attribute was not provided
-
-