Skip to content
Docs Try Aspire
Docs Try

JavaScriptHostingExtensions

Class static net8.0
📦 Aspire.Hosting.JavaScript v13.4.0
Provides extension methods for adding JavaScript applications to an Hosting.IDistributedApplicationBuilder.
namespace Aspire.Hosting;
public static class JavaScriptHostingExtensions
{
// ...
}
AddBunApp(IDistributedApplicationBuilder, string, string, string)extensionats export
IResourceBuilder<BunAppResource>
Adds a Bun application to the application model. Bun should be available on the PATH.
AddJavaScriptApp(IDistributedApplicationBuilder, string, string, string)extensionats export
IResourceBuilder<JavaScriptAppResource>
Adds a JavaScript application resource to the distributed application using the specified app directory and run script.
AddNextJsApp(IDistributedApplicationBuilder, string, string, string)extensionexperimentalats export
IResourceBuilder<NextJsAppResource>
Adds a Next.js app to the distributed application builder.
AddNodeApp(IDistributedApplicationBuilder, string, string, string)extensionats export
IResourceBuilder<NodeAppResource>
Adds a node application to the application model. Node should be available on the PATH.
AddViteApp(IDistributedApplicationBuilder, string, string, string)extensionats export
IResourceBuilder<ViteAppResource>
Adds a Vite app to the distributed application builder.
DisableBuildValidation(IResourceBuilder<NextJsAppResource>)extensionexperimentalats export
IResourceBuilder<NextJsAppResource>
Disables deploy-time build validation checks for the Next.js application.
PublishAsNodeServer(IResourceBuilder<TResource>, string, string)extensionexperimentalats export
IResourceBuilder<TResource>
Configures the JavaScript application to publish as a standalone Node.js server that runs a built artifact directly.
PublishAsPackageScript(IResourceBuilder<TResource>, string, string?)extensionexperimentalats export
IResourceBuilder<TResource>
Configures the JavaScript application to publish as a Node.js server that uses a package.json script at runtime.
PublishAsStaticWebsite(IResourceBuilder<TResource>, Action<PublishAsStaticWebsiteOptions>)extensionexperimentalats ignored
IResourceBuilder<TResource>
Configures the JavaScript application to publish as a standalone static website served by YARP.
PublishAsStaticWebsite(IResourceBuilder<TResource>, string, IResourceBuilder<IResourceWithServiceDiscovery>, Action<PublishAsStaticWebsiteOptions>)extensionexperimentalats ignored
IResourceBuilder<TResource>
Configures the JavaScript application to publish as a standalone static website served by YARP, with an API reverse-proxy to the specified resource.
WithBrowserDebugger(IResourceBuilder<T>, string)extensionexperimentalats export
IResourceBuilder<T>
Configures a browser debugger for the JavaScript application resource, enabling browser-based debugging through a child resource that launches when the parent application is ready.
WithBuildScript(IResourceBuilder<TResource>, string, string[]?)extensionats export
IResourceBuilder<TResource>
Adds a build script annotation to the resource builder using the specified command-line arguments.
WithBun(IResourceBuilder<TResource>, bool, string[]?)extensionats export
IResourceBuilder<TResource>
Configures the JavaScript resource to use Bun as the package manager and optionally installs packages before the application starts.
WithNpm(IResourceBuilder<TResource>, bool, string?, string[]?)extensionats export
IResourceBuilder<TResource>
Configures the Node.js resource to use npm as the package manager and optionally installs packages before the application starts.
WithPnpm(IResourceBuilder<TResource>, bool, string[]?)extensionats export
IResourceBuilder<TResource>
Configures the Node.js resource to use pnpm as the package manager and optionally installs packages before the application starts.
WithRunScript(IResourceBuilder<TResource>, string, string[]?)extensionats export
IResourceBuilder<TResource>
Adds a run script annotation to the specified JavaScript application resource builder, specifying the script to execute and its arguments during run mode.
WithViteConfig(IResourceBuilder<ViteAppResource>, string)extensionats export
IResourceBuilder<ViteAppResource>
Configures the Vite app to use the specified Vite configuration file instead of the default resolution behavior.
WithYarn(IResourceBuilder<TResource>, bool, string[]?)extensionats export
IResourceBuilder<TResource>
Configures the Node.js resource to use yarn as the package manager and optionally installs packages before the application starts.
View all methods