Skip to content

Commit 60e5c66

Browse files
Add PackageMangers and edit for clarity
1 parent a4806f7 commit 60e5c66

File tree

1 file changed

+9
-11
lines changed
  • src/content/docs/workers/frameworks/framework-guides

1 file changed

+9
-11
lines changed

src/content/docs/workers/frameworks/framework-guides/tanstack.mdx

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ head: []
55
description: Create an TanStack application and deploy it to Cloudflare Workers with Workers Assets.
66
---
77

8-
import { WranglerConfig } from "~/components";
8+
import { WranglerConfig, PackageManagers } from "~/components";
99

1010
In this guide, you will create a new [TanStack](https://tanstack.com/) application and deploy to Cloudflare Workers (with the new [Workers Assets](/workers/static-assets/)).
1111

@@ -21,25 +21,25 @@ npm install
2121

2222
## Develop locally
2323

24-
```sh
25-
npm run dev
26-
```
24+
<PackageManagers type="run" args={"dev"} />
2725

2826
## Preparing for Deployment to Cloudflare Workers
2927

28+
To prepare your TanStack application for deployment to Cloudflare Workers, follow three main steps: install the `unenv` package, modify the `app.config.ts` file, and add either a `wrangler.jsonc` or `wrangler.toml` file.
29+
3030
### Install `unenv` package
3131

3232
[`unenv`](https://github.com/unjs/unenv) is a package that normalizes runtime environments across Node.js, browsers, and edge runtimes like Cloudflare Workers. It’s essential for TanStack Router because certain Node.js APIs are unavailable in the Workers environment. `unenv` offers compatible replacements for those APIs.
3333

34-
```sh
35-
npm install unenv
36-
```
34+
<PackageManagers pkg="unenv" type="install" />
3735

3836
### Modify the `app.config.ts` file
3937

4038
To configure your application for Cloudflare Workers deployment, add the following lines to your `app.config.ts` file:
4139

4240
```ts
41+
import { cloudflare } from 'unenv'
42+
4343
server: {
4444
preset: "cloudflare-module",
4545
unenv: cloudflare,
@@ -48,7 +48,7 @@ To configure your application for Cloudflare Workers deployment, add the followi
4848

4949
This will set the correct build format and runtime environment for Cloudflare.
5050

51-
### Add a Wrnagler file
51+
### Add a Wrangler file
5252

5353
Create a `wrangler.jsonc` or `wrangler.toml` file in the root of your project. This file is used to configure the Cloudflare Workers deployment.
5454

@@ -74,9 +74,7 @@ Create a `wrangler.jsonc` or `wrangler.toml` file in the root of your project. T
7474

7575
You need to build your application before deploying it to Cloudflare Workers.
7676

77-
```sh
78-
npm run build
79-
```
77+
<PackageManagers type="run" args={"build"} />
8078

8179
### Deploy the application
8280

0 commit comments

Comments
 (0)