This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Note
Access to this page requires authorization. You can trysigning in orchanging directories.
Access to this page requires authorization. You can trychanging directories.
Includes: Hosting integration only —
Client integration not included
Note
This integration is part of theAspire Community Toolkit andisn't officially supported by the Aspire team.
In this article, you learn about the Aspire Community Toolkit Node.js hosting extensions package which provides extra functionality to the AspireNodeJS hosting package. The extensions package brings the following features:
To get started with the Aspire Community Toolkit Node.js hosting extensions, install the📦 CommunityToolkit.Aspire.Hosting.NodeJS.Extensions NuGet package in the AppHost project.
dotnet add package CommunityToolkit.Aspire.Hosting.NodeJS.ExtensionsFor more information, seedotnet add package orManage package dependencies in .NET applications.
The following sections detail various usages, from running Vite applications to using specific package managers.
This integration extension adds support for running Node.js applications using Yarn or pnpm as the package manager.
var builder = DistributedApplication.CreateBuilder(args);builder.AddYarnApp("yarn-demo") .WithExternalHttpEndpoints();This integration extension adds support for running the development server for Vite applications. By default, it uses thenpm package manager to launch, but this can be overridden with thepackageManager argument.
var builder = DistributedApplication.CreateBuilder(args);builder.AddViteApp("vite-demo") .WithExternalHttpEndpoints();builder.AddViteApp("yarn-demo", packageManager: "yarn") .WithExternalHttpEndpoints();builder.AddViteApp("pnpm-demo", packageManager: "pnpm") .WithExternalHttpEndpoints();builder.Build().Run();When using theWithNpmPackageInstallation,WithYarnPackageInstallation orWithPnpmPackageInstallation methods, the package manager is used to install the packages before starting the application. These methods are useful to ensure that packages are installed before the application starts, similar to how a .NET application would restore NuGet packages before running.
Was this page helpful?
Need help with this topic?
Want to try using Ask Learn to clarify or guide you through this topic?
Was this page helpful?
Want to try using Ask Learn to clarify or guide you through this topic?