Skip to content
Docs Try Aspire

JavaScriptHostingExtensions

Class static net10.0
📦 Aspire.Hosting.JavaScript v13.1.2
Provides extension methods for adding JavaScript applications to an Hosting.IDistributedApplicationBuilder.
namespace Aspire.Hosting;
public static class JavaScriptHostingExtensions
{
// ...
}
AddJavaScriptApp(IDistributedApplicationBuilder, string, string, string)extension
IResourceBuilder<JavaScriptAppResource>
Adds a JavaScript application resource to the distributed application using the specified app directory and run script.
AddNodeApp(IDistributedApplicationBuilder, string, string, string)extension
IResourceBuilder<NodeAppResource>
Adds a node application to the application model. Node should be available on the PATH.
AddViteApp(IDistributedApplicationBuilder, string, string, string)extension
IResourceBuilder<ViteAppResource>
Adds a Vite app to the distributed application builder.
WithBuildScript(IResourceBuilder<TResource>, string, string[]?)extension
IResourceBuilder<TResource>
Adds a build script annotation to the resource builder using the specified command-line arguments.
WithNpm(IResourceBuilder<TResource>, bool, string?, string[]?)extension
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[]?)extension
IResourceBuilder<TResource>
Configures the Node.js resource to use pnmp as the package manager and optionally installs packages before the application starts.
WithRunScript(IResourceBuilder<TResource>, string, string[]?)extension
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)extension
IResourceBuilder<ViteAppResource>
Configures the Vite app to use the specified Vite configuration file instead of the default resolution behavior.
WithYarn(IResourceBuilder<TResource>, bool, string[]?)extension
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