Class BundlingOptions.Builder
- java.lang.Object
-
- io.github.cdklabs.projen.javascript.BundlingOptions.Builder
-
- All Implemented Interfaces:
software.amazon.jsii.Builder<BundlingOptions>
- Enclosing interface:
- BundlingOptions
@Stability(Experimental) public static final class BundlingOptions.Builder extends Object implements software.amazon.jsii.Builder<BundlingOptions>
A builder forBundlingOptions
-
-
Constructor Summary
Constructors Constructor Description Builder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description BundlingOptionsbuild()Builds the configured instance.BundlingOptions.Builderexternals(List<String> externals)Sets the value ofBundlingOptions.getExternals()BundlingOptions.Buildersourcemap(Boolean sourcemap)Sets the value ofBundlingOptions.getSourcemap()BundlingOptions.BuilderwatchTask(Boolean watchTask)Sets the value ofBundlingOptions.getWatchTask()
-
-
-
Method Detail
-
externals
@Stability(Experimental) public BundlingOptions.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 BundlingOptions.Builder sourcemap(Boolean sourcemap)
Sets the value ofBundlingOptions.getSourcemap()- Parameters:
sourcemap- Include a source map in the bundle.- Returns:
this
-
watchTask
@Stability(Experimental) public BundlingOptions.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 BundlingOptions build()
Builds the configured instance.- Specified by:
buildin interfacesoftware.amazon.jsii.Builder<BundlingOptions>- Returns:
- a new instance of
BundlingOptions - Throws:
NullPointerException- if any required attribute was not provided
-
-