Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 0 additions & 14 deletions src/frontend/src/content/docs/deployment/javascript-apps.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,6 @@ To deploy a JavaScript app, choose which resource owns the public HTTP surface i
- Use a JavaScript publish method when the JavaScript app resource should become the deployed static website or Node.js server.
- Use `AddNextJsApp(...)` for a Next.js app that publishes as a standalone Next.js server.

:::caution[Experimental]
The JavaScript app resource publish methods and `AddNextJsApp` are marked `[Experimental]` and require suppressing the `ASPIREJAVASCRIPT001` diagnostic.
:::

If you only add a Vite or JavaScript app and reference backend services, Aspire still needs one of these production hosting patterns to know who serves requests in deployment. During publish or deploy, Aspire validates that build-only containers are either consumed by another resource through `PublishWithContainerFiles(...)` or `PublishWithStaticFiles(...)`, or converted into a deployable JavaScript resource with a JavaScript publish method. An unconsumed build-only container does not participate in deployment.

<Aside type="note">
Expand Down Expand Up @@ -280,8 +276,6 @@ Choose this shape instead of `PublishWithStaticFiles(...)` when you do not alrea
<TabItem id='csharp' label='C#'>

```csharp title="AppHost.cs"
#pragma warning disable ASPIREJAVASCRIPT001

var builder = DistributedApplication.CreateBuilder(args);
builder.AddDockerComposeEnvironment("compose");

Expand Down Expand Up @@ -372,8 +366,6 @@ Choose this method instead of `PublishAsPackageScript` when the build output doe
<TabItem id='csharp' label='C#'>

```csharp title="AppHost.cs"
#pragma warning disable ASPIREJAVASCRIPT001

var builder = DistributedApplication.CreateBuilder(args);
builder.AddDockerComposeEnvironment("compose");

Expand Down Expand Up @@ -434,8 +426,6 @@ Choose this method instead of `PublishAsNodeServer` when the production server i
<TabItem id='csharp' label='C#'>

```csharp title="AppHost.cs"
#pragma warning disable ASPIREJAVASCRIPT001

var builder = DistributedApplication.CreateBuilder(args);
builder.AddDockerComposeEnvironment("compose");

Expand Down Expand Up @@ -496,8 +486,6 @@ The generated container sets `HOST=0.0.0.0` and `HOSTNAME=0.0.0.0` so the server
- **Bun**: The runtime stage reuses the Bun build image rather than switching to a Node.js image, because `bun run <script>` requires the Bun runtime at startup.

```csharp title="AppHost.cs — pnpm package-script publish"
#pragma warning disable ASPIREJAVASCRIPT001

var builder = DistributedApplication.CreateBuilder(args);
builder.AddDockerComposeEnvironment("compose");

Expand Down Expand Up @@ -527,8 +515,6 @@ Choose this method instead of `AddJavaScriptApp(...).PublishAsPackageScript(...)
<TabItem id='csharp' label='C#'>

```csharp title="AppHost.cs"
#pragma warning disable ASPIREJAVASCRIPT001

var builder = DistributedApplication.CreateBuilder(args);
builder.AddDockerComposeEnvironment("compose");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ seoTitle: 'ASPIREJAVASCRIPT001: JavaScript hosting APIs are for'
description: Learn what causes the Aspire compiler warning ASPIREJAVASCRIPT001 and how to fix it so your AppHost builds cleanly.
---

import { Badge } from '@astrojs/starlight/components';
import { Aside, Badge } from '@astrojs/starlight/components';
import ApiReference from '@components/ApiReference.astro';

<Badge
Expand All @@ -16,7 +16,11 @@ import ApiReference from '@components/ApiReference.astro';

> JavaScript hosting APIs are for evaluation purposes only and are subject to change or removal in future updates. Suppress this diagnostic to proceed.

This diagnostic warning is reported when using experimental JavaScript hosting and publishing APIs in Aspire, including:
<Aside type="note">
The Next.js hosting API (`AddNextJsApp`, `DisableBuildValidation`) and the JavaScript publishing APIs (`PublishAsStaticWebsite`, `PublishAsNodeServer`, `PublishAsPackageScript`) are now stable and no longer report this diagnostic. You can remove any suppressions you added for them.
</Aside>

This diagnostic warning was reported when using these JavaScript hosting and publishing APIs in Aspire:

- <ApiReference name="Aspire.Hosting.JavaScriptHostingExtensions.PublishAsStaticWebsite" />
- <ApiReference name="Aspire.Hosting.JavaScriptHostingExtensions.PublishAsNodeServer" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,10 +167,6 @@ export async function loadWeather() {

Next.js standalone apps use the dedicated `addNextJsApp` helper, not a generic Vite app. Read Aspire-provided values from server-side code paths with `process.env`.

:::caution[Experimental]
`AddNextJsApp` is marked `[Experimental]`. In C# AppHosts, suppress the `ASPIREJAVASCRIPT001` diagnostic when you use this API.
:::

```typescript title="apphost.mts"
await builder
.addNextJsApp('nextjs', './frameworks/nextjs', { runScriptName: 'dev' })
Expand Down Expand Up @@ -423,18 +419,12 @@ The `AddNodeApp` method requires:

## Add Next.js application

:::caution[Experimental]
`AddNextJsApp` is marked `[Experimental]`. In C# AppHosts, suppress the `ASPIREJAVASCRIPT001` diagnostic when you use this API.
:::

For [Next.js](https://nextjs.org/) applications, use the `AddNextJsApp` extension method. It provides Next.js-specific defaults for both run mode and publish mode:

<Tabs syncKey='aspire-lang'>
<TabItem id='csharp' label='C#'>

```csharp title="AppHost.cs"
#pragma warning disable ASPIREJAVASCRIPT001

var builder = DistributedApplication.CreateBuilder(args);

var api = builder
Expand Down Expand Up @@ -496,8 +486,6 @@ To opt out of the configuration validation step, call <ApiReference name="Aspire
<TabItem id='csharp' label='C#'>

```csharp title="AppHost.cs"
#pragma warning disable ASPIREJAVASCRIPT001

var nextApp = builder.AddNextJsApp("next-app", "./next-app")
.DisableBuildValidation();
```
Expand Down
Loading