# WithBuildScript

- Module: [Aspire.Hosting.JavaScript](/reference/api/go/aspire.hosting.javascript.md)
- Version: `17.0.0`
- Kind: `method`
- Defined on: [`JavaScriptAppResource`](/reference/api/go/aspire.hosting.javascript/javascriptappresource.md)
- Source: [GitHub](https://github.com/microsoft/aspire/tree/bcfa151cdca6d0a573f22d5d9c23f9c727cb3b2f)

Adds a build script annotation to the resource builder using the specified command-line arguments.

## Remarks

Use this method to specify custom build scripts for JavaScript application resources during
deployment.

## Definition

```go
func (JavaScriptAppResource) WithBuildScript(
    scriptName string,
    options ...*WithBuildScriptOptions,
) JavaScriptAppResource
```

## Parameters

- `scriptName` (`string`) -- The name of the script to be executed when the resource is built.
- `options` (`...*WithBuildScriptOptions`) -- optional settings, see [Options](#options)

## Options

Optional parameters are passed in a trailing `options ...*WithBuildScriptOptions` argument.

- `Args` (`[]string`) -- An array of command-line arguments to use for the build script.

## Returns

[`JavaScriptAppResource`](/reference/api/go/aspire.hosting.javascript/javascriptappresource.md) -- The same resource builder instance with the build script annotation applied.

Returns a handle; failures surface later via `Err()`.

## Applies to

- [`BunAppResource`](/reference/api/go/aspire.hosting.javascript/bunappresource.md)
- [`DenoAppResource`](/reference/api/go/aspire.hosting.javascript/denoappresource.md)
- [`JavaScriptAppResource`](/reference/api/go/aspire.hosting.javascript/javascriptappresource.md)
- [`NextJsAppResource`](/reference/api/go/aspire.hosting.javascript/nextjsappresource.md)
- [`NodeAppResource`](/reference/api/go/aspire.hosting.javascript/nodeappresource.md)
- [`ViteAppResource`](/reference/api/go/aspire.hosting.javascript/viteappresource.md)
